接口 CacheProvider
- 所有已知实现类:
CaffeineProvider,EhCacheProvider,EhCacheProvider3,LettuceCacheProvider,NullCacheProvider,ReadonlyRedisCacheProvider,RedisCacheProvider,XmemcachedCacheProvider
public interface CacheProvider
Support for pluggable caches.
- 作者:
- Winter Lau(javayou@gmail.com)
-
方法概要
修饰符和类型方法说明buildCache(String region, long timeToLiveInSeconds, CacheExpiredListener listener) Configure the cache with timeToLiveInMillsbuildCache(String regionName, CacheExpiredListener listener) Configure the cachedefault booleanisLevel(int level) intlevel()缓存的层级name()缓存的标识名称regions()Return all channels defined in first level cachedefault voidremoveCache(String region) Remove a cache regionvoidstart(Properties props) Callback to perform any necessary initialization of the underlying cache implementation during SessionFactory construction.voidstop()Callback to perform any necessary cleanup of the underlying cache implementation during SessionFactory.close().
-
方法详细资料
-
name
String name()缓存的标识名称- 返回:
- return cache provider name
-
level
int level()缓存的层级- 返回:
- current provider level
-
isLevel
default boolean isLevel(int level) -
buildCache
Configure the cache- 参数:
regionName- the name of the cache regionlistener- listener for expired elements- 返回:
- return cache instance
-
buildCache
Configure the cache with timeToLiveInMills- 参数:
region- cache region nametimeToLiveInSeconds- time to live in secondlistener- listener for expired elements- 返回:
- return cache instance
-
removeCache
Remove a cache region- 参数:
region- cache region name
-
regions
Collection<CacheChannel.Region> regions()Return all channels defined in first level cache- 返回:
- all regions name
-
start
Callback to perform any necessary initialization of the underlying cache implementation during SessionFactory construction.- 参数:
props- current configuration settings.
-
stop
void stop()Callback to perform any necessary cleanup of the underlying cache implementation during SessionFactory.close().
-