public interface EhCacheComponents extends ConfigurationComponents, AkkaComponents
Usage:
public class MyComponents extends BuiltInComponentsFromContext implements EhCacheComponents { public MyComponents(ApplicationLoader.Context context) { super(context); } // A service class that depends on cache APIs public CachedService someService() { // defaultCacheApi is provided by EhCacheComponents return new CachedService(defaultCacheApi()); } // Another service that depends on a specific named cache public AnotherService someService() { // cacheApi provided by EhCacheComponents and // "anotherService" is the name of the cache. return new CachedService(cacheApi("anotherService")); } // other methods }
Modifier and Type | Method and Description |
---|---|
ApplicationLifecycle |
applicationLifecycle() |
default AsyncCacheApi |
cacheApi(java.lang.String name) |
default AsyncCacheApi |
defaultCacheApi() |
default net.sf.ehcache.CacheManager |
ehCacheManager() |
Environment |
environment() |
config, configuration
actorSystem, executionContext, materializer
Environment environment()
ApplicationLifecycle applicationLifecycle()
default net.sf.ehcache.CacheManager ehCacheManager()
default AsyncCacheApi cacheApi(java.lang.String name)
default AsyncCacheApi defaultCacheApi()