All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.bingoohuang.springrediscache.RefreshSecondsProcessor Maven / Gradle / Ivy

The newest version!
package com.github.bingoohuang.springrediscache;

class RefreshSecondsProcessor implements CacheProcessor {
    private final InvocationRuntime runtime;

    RefreshSecondsProcessor(InvocationRuntime runtime) {
        this.runtime = runtime;
    }

    @Override
    public Object process() {
        Object value = runtime.getLocalCache();
        if (value != null) return value;

        try {
            runtime.waitCacheLock();

            // check again
            value = runtime.getLocalCache();
            if (value != null) return value;

            return runtime.invokeMethodAndPutCache();
        } finally {
            runtime.unlockLocalCache();
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy