Package dev.relism.flash.ext.cache
Interface CacheManager
public interface CacheManager
Creates and hands back named caches. Resolve it with
require(CacheManager.class); a
backend extension such as flash-ext-cache-caffeine provides the implementation.
@Override protected void onInit() {
users = require(CacheManager.class).build("users", spec -> spec
.maxSize(10_000)
.ttl(Duration.ofMinutes(10)));
}
build(java.lang.String, java.util.function.Consumer<dev.relism.flash.ext.cache.CacheSpec>) is idempotent per name: calling it twice returns the same cache rather than
two, so several handlers can share one without coordinating who creates it. The spec of the
first call wins; a later call with a different spec is a configuration mistake and throws.
-
Method Summary
Modifier and TypeMethodDescription<K,V> Cache <K, V> Creates the named cache, or returns the existing one.<K,V> Cache <K, V> The named cache, ornullifbuild(java.lang.String, java.util.function.Consumer<dev.relism.flash.ext.cache.CacheSpec>)has not been called for it.names()Every cache name built so far, for an ops endpoint.
-
Method Details
-
build
Creates the named cache, or returns the existing one. -
cache
The named cache, ornullifbuild(java.lang.String, java.util.function.Consumer<dev.relism.flash.ext.cache.CacheSpec>)has not been called for it. -
names
Every cache name built so far, for an ops endpoint.
-