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.