Package io.ebeaninternal.server.cache
Class DefaultServerCacheManager
- java.lang.Object
-
- io.ebeaninternal.server.cache.DefaultServerCacheManager
-
- All Implemented Interfaces:
SpiCacheManager
public class DefaultServerCacheManager extends Object implements SpiCacheManager
Manages the bean and query caches.
-
-
Constructor Summary
Constructors Constructor Description DefaultServerCacheManager()
Construct when l2 cache is disabled.DefaultServerCacheManager(CacheManagerOptions builder)
Create with a cache factory and default cache options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ServerCacheRegion>
allRegions()
Return all the regions.void
clear(Class<?> beanType)
Clear the caches for the given bean type.void
clearAll()
Clear all caches.void
clearAllLocal()
Clear all local caches.void
clearLocal(Class<?> beanType)
Clear local caches for the given bean type.ServerCache
getBeanCache(Class<?> beanType)
Return the bean cache for a given bean type.ServerCache
getCollectionIdsCache(Class<?> beanType, String collectionProperty)
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 query cache for a given bean type.SpiCacheRegion
getRegion(String region)
Return the cache region.boolean
isLocalL2Caching()
Return true if the L2 caching is local.void
setAllRegionsEnabled(boolean enabled)
Enable or disable all cache regions.void
setEnabledRegions(String regions)
Set the regions that are enabled.void
visitMetrics(MetricVisitor visitor)
Visit and collect the metrics.
-
-
-
Constructor Detail
-
DefaultServerCacheManager
public DefaultServerCacheManager(CacheManagerOptions builder)
Create with a cache factory and default cache options.
-
DefaultServerCacheManager
public DefaultServerCacheManager()
Construct when l2 cache is disabled.
-
-
Method Detail
-
isLocalL2Caching
public boolean isLocalL2Caching()
Description copied from interface:SpiCacheManager
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 interfaceSpiCacheManager
-
allRegions
public List<ServerCacheRegion> allRegions()
Description copied from interface:SpiCacheManager
Return all the regions.- Specified by:
allRegions
in interfaceSpiCacheManager
-
setEnabledRegions
public void setEnabledRegions(String regions)
Description copied from interface:SpiCacheManager
Set the regions that are enabled.- Specified by:
setEnabledRegions
in interfaceSpiCacheManager
- Parameters:
regions
- A single region name or a comma delimited list of region names.
-
setAllRegionsEnabled
public void setAllRegionsEnabled(boolean enabled)
Description copied from interface:SpiCacheManager
Enable or disable all cache regions.- Specified by:
setAllRegionsEnabled
in interfaceSpiCacheManager
-
getRegion
public SpiCacheRegion getRegion(String region)
Description copied from interface:SpiCacheManager
Return the cache region. We can enable L2 caching by region.- Specified by:
getRegion
in interfaceSpiCacheManager
-
visitMetrics
public void visitMetrics(MetricVisitor visitor)
Description copied from interface:SpiCacheManager
Visit and collect the metrics.- Specified by:
visitMetrics
in interfaceSpiCacheManager
-
clearAll
public void clearAll()
Clear all caches.- Specified by:
clearAll
in interfaceSpiCacheManager
-
clearAllLocal
public void clearAllLocal()
Description copied from interface:SpiCacheManager
Clear all local caches.- Specified by:
clearAllLocal
in interfaceSpiCacheManager
-
clear
public void clear(Class<?> beanType)
Description copied from interface:SpiCacheManager
Clear the caches for the given bean type.- Specified by:
clear
in interfaceSpiCacheManager
-
clearLocal
public void clearLocal(Class<?> beanType)
Description copied from interface:SpiCacheManager
Clear local caches for the given bean type.- Specified by:
clearLocal
in interfaceSpiCacheManager
-
getCollectionIdsCache
public ServerCache getCollectionIdsCache(Class<?> beanType, String collectionProperty)
Description copied from interface:SpiCacheManager
Return the cache for associated many properties of a bean type.- Specified by:
getCollectionIdsCache
in interfaceSpiCacheManager
-
getNaturalKeyCache
public ServerCache getNaturalKeyCache(Class<?> beanType)
Description copied from interface:SpiCacheManager
Return the cache for mapping natural keys to id values.- Specified by:
getNaturalKeyCache
in interfaceSpiCacheManager
-
getQueryCache
public ServerCache getQueryCache(Class<?> beanType)
Return the query cache for a given bean type.- Specified by:
getQueryCache
in interfaceSpiCacheManager
-
getBeanCache
public ServerCache getBeanCache(Class<?> beanType)
Return the bean cache for a given bean type.- Specified by:
getBeanCache
in interfaceSpiCacheManager
-
-