class CouchbaseAccessor extends AbstractStorageAccessor {

        private final Collection collection;

        CouchbaseAccessor(Collection collection) {
            this.collection = collection;
        }

        @Override
        public boolean insertRecord(@NonNull LockConfiguration lockConfiguration) {
            JsonObject content = JsonObject.create()
                    .put(LOCK_NAME, lockConfiguration.getName())
                    .put(LOCK_UNTIL, toIsoString(lockConfiguration.getLockAtMostUntil()))
                    .put(LOCKED_AT, toIsoString(ClockProvider.now()))
                    .put(LOCKED_BY, getHostname());

            try {
                collection.insert(lockConfiguration.getName(), content);
            } catch (DocumentExistsException e) {
                return false;
            }
            return true;
        }

        private Instant parse(Object instant) {
            return Instant.parse((String) instant);
        }

        @Override
        public boolean updateRecord(@NonNull LockConfiguration lockConfiguration) {<FILL_FUNCTION_BODY>}

        @Override
        public boolean extend(@NonNull LockConfiguration lockConfiguration) {
            GetResult result = collection.get(lockConfiguration.getName());
            JsonObject document = result.contentAsObject();

            Instant lockUntil = parse(document.get(LOCK_UNTIL));
            Instant now = ClockProvider.now();
            if (lockUntil.isBefore(now) || !document.get(LOCKED_BY).equals(getHostname())) {
                return false;
            }

            document.put(LOCK_UNTIL, toIsoString(lockConfiguration.getLockAtMostUntil()));

            try {
                collection.replace(
                        lockConfiguration.getName(),
                        document,
                        ReplaceOptions.replaceOptions().cas(result.cas()));
            } catch (CasMismatchException e) {
                return false;
            }
            return true;
        }

        @Override
        public void unlock(@NonNull LockConfiguration lockConfiguration) {
            GetResult result = collection.get(lockConfiguration.getName());
            JsonObject document = result.contentAsObject();

            document.put(LOCK_UNTIL, toIsoString(lockConfiguration.getUnlockTime()));
            collection.replace(lockConfiguration.getName(), document);
        }
    }

            GetResult result = collection.get(lockConfiguration.getName());
            JsonObject document = result.contentAsObject();

            Instant lockUntil = parse(document.get(LOCK_UNTIL));
            Instant now = ClockProvider.now();
            if (lockUntil.isAfter(now)) {
                return false;
            }

            document.put(LOCK_UNTIL, toIsoString(lockConfiguration.getLockAtMostUntil()));
            document.put(LOCKED_AT, toIsoString(now));
            document.put(LOCKED_BY, getHostname());

            try {
                collection.replace(
                        lockConfiguration.getName(),
                        document,
                        ReplaceOptions.replaceOptions().cas(result.cas()));
            } catch (CasMismatchException e) {
                return false;
            }
            return true;
        
<methods>public void clearCache() ,public Optional<net.javacrumbs.shedlock.core.SimpleLock> lock(net.javacrumbs.shedlock.core.LockConfiguration) <variables>private final net.javacrumbs.shedlock.support.LockRecordRegistry lockRecordRegistry,private final non-sealed net.javacrumbs.shedlock.support.StorageAccessor storageAccessor