class CaffeineProxyManager<K> extends AbstractProxyManager<K> {

    private final Cache<K, RemoteBucketState> cache;

    /**
     * Creates new instance of {@link CaffeineProxyManager}
     *
     * @param builder the builder that will be used for cache creation
     * @param keepAfterRefillDuration specifies how long bucket should be held in the cache after all consumed tokens have been refilled.
     */
    public CaffeineProxyManager(Caffeine<? super K, ? super RemoteBucketState> builder, Duration keepAfterRefillDuration) {
        this(builder, keepAfterRefillDuration, ClientSideConfig.getDefault());
    }

    public CaffeineProxyManager(Caffeine<? super K, ? super RemoteBucketState> builder, Duration keepAfterRefillDuration, ClientSideConfig clientSideConfig) {
        super(clientSideConfig);
        this.cache = builder
            .expireAfter(new Expiry<K, RemoteBucketState>() {
                @Override
                public long expireAfterCreate(K key, RemoteBucketState bucketState, long currentTime) {
                    long currentTimeNanos = getCurrentTime(clientSideConfig);
                    long nanosToFullRefill = bucketState.calculateFullRefillingTime(currentTimeNanos);
                    return nanosToFullRefill + keepAfterRefillDuration.toNanos();
                }

                @Override
                public long expireAfterUpdate(K key, RemoteBucketState bucketState, long currentTime, long currentDuration) {
                    long currentTimeNanos = getCurrentTime(clientSideConfig);
                    long nanosToFullRefill = bucketState.calculateFullRefillingTime(currentTimeNanos);
                    return nanosToFullRefill + keepAfterRefillDuration.toNanos();
                }

                @Override
                public long expireAfterRead(K key, RemoteBucketState bucketState, long currentTime, long currentDuration) {
                    long currentTimeNanos = getCurrentTime(clientSideConfig);
                    long nanosToFullRefill = bucketState.calculateFullRefillingTime(currentTimeNanos);
                    return nanosToFullRefill + keepAfterRefillDuration.toNanos();
                }
            })
            .build();
    }

    /**
     * Returns the cache that is used for storing the buckets
     *
     * @return the cache that is used for storing the buckets
     */
    public Cache<K, RemoteBucketState> getCache() {
        return cache;
    }

    @Override
    public <T> CommandResult<T> execute(K key, Request<T> request) {<FILL_FUNCTION_BODY>}

    @Override
    public boolean isAsyncModeSupported() {
        return true;
    }

    @Override
    public <T> CompletableFuture<CommandResult<T>> executeAsync(K key, Request<T> request) {
        CommandResult<T> result = execute(key, request);
        return CompletableFuture.completedFuture(result);
    }

    @Override
    public void removeProxy(K key) {
        cache.asMap().remove(key);
    }

    @Override
    protected CompletableFuture<Void> removeAsync(K key) {
        cache.asMap().remove(key);
        return CompletableFuture.completedFuture(null);
    }

    private static long getCurrentTime(ClientSideConfig clientSideConfig) {
        Optional<TimeMeter> clock = clientSideConfig.getClientSideClock();
        return clock.isPresent() ? clock.get().currentTimeNanos() : System.currentTimeMillis() * 1_000_000;
    }

}

        CommandResult<T>[] resultHolder = new CommandResult[1];

        cache.asMap().compute(key, (K k, RemoteBucketState previousState) -> {
            Long clientSideTime = request.getClientSideTime();
            long timeNanos = clientSideTime != null ? clientSideTime : System.currentTimeMillis() * 1_000_000;
            MutableBucketEntry entryWrapper = new MutableBucketEntry(previousState == null ? null : previousState.copy());
            resultHolder[0] = request.getCommand().execute(entryWrapper, timeNanos);
            return entryWrapper.exists() ? entryWrapper.get() : null;
        });

        return resultHolder[0];
    
<methods>public AsyncProxyManager<K> asAsync() ,public RemoteBucketBuilder<K> builder() ,public Optional<io.github.bucket4j.BucketConfiguration> getProxyConfiguration(K) <variables>private static final io.github.bucket4j.distributed.proxy.RecoveryStrategy DEFAULT_RECOVERY_STRATEGY,private static final io.github.bucket4j.distributed.proxy.optimization.Optimization DEFAULT_REQUEST_OPTIMIZER,private AsyncProxyManager<K> asyncView,private final non-sealed io.github.bucket4j.distributed.proxy.ClientSideConfig clientSideConfig