Package io.ebeaninternal.server.cache
Class DefaultCacheAdapter
- java.lang.Object
-
- io.ebeaninternal.server.cache.DefaultCacheAdapter
-
- All Implemented Interfaces:
ServerCacheManager
public class DefaultCacheAdapter extends Object implements ServerCacheManager
Adapts SpiCacheManager to ServerCacheManager.Used to hide the Supplier part of the SpiCacheManager API from public use.
-
-
Constructor Summary
Constructors Constructor Description DefaultCacheAdapter(SpiCacheManager cacheManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ServerCacheRegion>
allRegions()
Return all the cache regions.void
clear(Class<?> beanType)
This clears both the bean and query cache for a given type.void
clearAll()
Clear all the caches.void
clearAllLocal()
Clear all the local caches.void
clearLocal(Class<?> beanType)
Clear the local caches for this bean type.ServerCache
getBeanCache(Class<?> beanType)
Return the cache for beans of a particular type.ServerCache
getCollectionIdsCache(Class<?> beanType, String propertyName)
Return the cache for associated many properties of a bean type.ServerCache
getNaturalKeyCache(Class<?> beanType)
Return the cache for mapping natural keys to id values.ServerCache
getQueryCache(Class<?> beanType)
Return the cache for query results of a particular type of bean.ServerCacheRegion
getRegion(String region)
Return the cache region by name.boolean
isLocalL2Caching()
Return true if the L2 caching is local.void
setAllRegionsEnabled(boolean enabled)
Enable or disable all the cache regions.void
setEnabledRegions(String regions)
Set the regions that are enabled.void
visitMetrics(MetricVisitor visitor)
Visit the metrics for all the server caches.
-
-
-
Constructor Detail
-
DefaultCacheAdapter
public DefaultCacheAdapter(SpiCacheManager cacheManager)
-
-
Method Detail
-
visitMetrics
public void visitMetrics(MetricVisitor visitor)
Description copied from interface:ServerCacheManager
Visit the metrics for all the server caches.- Specified by:
visitMetrics
in interfaceServerCacheManager
-
isLocalL2Caching
public boolean isLocalL2Caching()
Description copied from interface:ServerCacheManager
Return true if the L2 caching is local.Local L2 caching means that the cache updates should occur in foreground rather than background processing.
- Specified by:
isLocalL2Caching
in interfaceServerCacheManager
-
allRegions
public List<ServerCacheRegion> allRegions()
Description copied from interface:ServerCacheManager
Return all the cache regions.- Specified by:
allRegions
in interfaceServerCacheManager
-
setEnabledRegions
public void setEnabledRegions(String regions)
Description copied from interface:ServerCacheManager
Set the regions that are enabled.Typically this is set on startup and at runtime (via dynamic configuration).
- Specified by:
setEnabledRegions
in interfaceServerCacheManager
- Parameters:
regions
- A region name or comma delimited list of region names.
-
getRegion
public ServerCacheRegion getRegion(String region)
Description copied from interface:ServerCacheManager
Return the cache region by name. Typically to enable or disable the region.- Specified by:
getRegion
in interfaceServerCacheManager
-
setAllRegionsEnabled
public void setAllRegionsEnabled(boolean enabled)
Description copied from interface:ServerCacheManager
Enable or disable all the cache regions.- Specified by:
setAllRegionsEnabled
in interfaceServerCacheManager
-
getNaturalKeyCache
public ServerCache getNaturalKeyCache(Class<?> beanType)
Description copied from interface:ServerCacheManager
Return the cache for mapping natural keys to id values.- Specified by:
getNaturalKeyCache
in interfaceServerCacheManager
-
getBeanCache
public ServerCache getBeanCache(Class<?> beanType)
Description copied from interface:ServerCacheManager
Return the cache for beans of a particular type.- Specified by:
getBeanCache
in interfaceServerCacheManager
-
getCollectionIdsCache
public ServerCache getCollectionIdsCache(Class<?> beanType, String propertyName)
Description copied from interface:ServerCacheManager
Return the cache for associated many properties of a bean type.- Specified by:
getCollectionIdsCache
in interfaceServerCacheManager
-
getQueryCache
public ServerCache getQueryCache(Class<?> beanType)
Description copied from interface:ServerCacheManager
Return the cache for query results of a particular type of bean.- Specified by:
getQueryCache
in interfaceServerCacheManager
-
clear
public void clear(Class<?> beanType)
Description copied from interface:ServerCacheManager
This clears both the bean and query cache for a given type.- Specified by:
clear
in interfaceServerCacheManager
-
clearAll
public void clearAll()
Description copied from interface:ServerCacheManager
Clear all the caches.- Specified by:
clearAll
in interfaceServerCacheManager
-
clearAllLocal
public void clearAllLocal()
Description copied from interface:ServerCacheManager
Clear all the local caches.This is used when the L2 Cache is based on clustered near-caches (Like Ebean-K8s-L2Cache). It is not used when the L2 cache is a distributed cache such as HazelCast or Ignite etc.
- Specified by:
clearAllLocal
in interfaceServerCacheManager
-
clearLocal
public void clearLocal(Class<?> beanType)
Description copied from interface:ServerCacheManager
Clear the local caches for this bean type.This is used when the L2 Cache is based on clustered near-caches (Like Ebean-K8s-L2Cache). It is not used when the L2 cache is a distributed cache such as HazelCast or Ignite etc.
- Specified by:
clearLocal
in interfaceServerCacheManager
-
-