public final class DefaultCacheConfig extends Object implements ICacheConfig
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultCacheConfig.Builder |
CONFIG_FILE, DEFAULT_CACHE_NAME, DEFAULT_CACHE_TIMEOUT, DEFAULT_CONFIG_FILE, DEFAULT_STR, ENABLED_SUBSCRIBE_EXPIRED, EVENT_LISTENER_CLASS, KEY_GENERATOR_CLASS, MULTILEVEL_SLAVE_AUTO_SYNC, PROVIDER_CLASS, SCOPE_PROCESSOR_CLASS, SERIALIZER_CLASS, STORAGE_WITH_SET| Modifier and Type | Method and Description |
|---|---|
static DefaultCacheConfig.Builder |
builder() |
static DefaultCacheConfig |
create(Class<?> mainClass,
IModuleConfigurer moduleConfigurer) |
static DefaultCacheConfig |
create(IModuleConfigurer moduleConfigurer) |
static DefaultCacheConfig |
defaultConfig() |
ICacheEventListener |
getCacheEventListener()
缓存对象事件监听器,可选参数,默认值为空
|
ICacheProvider |
getCacheProvider()
缓存提供者,可选参数,默认值为 net.ymate.platform.cache.impl.DefaultCacheProvider
|
ICacheScopeProcessor |
getCacheScopeProcessor()
缓存作用域处理器,可选参数,默认值为空
|
File |
getConfigFile()
获取Ehcache配置文件,可选参数,若未设置或设置的文件路径无效将被忽略,默认值为空
|
String |
getDefaultCacheName()
默认缓存名称,可选参数,默认值为default,对应于Ehcache配置文件中设置name="__DEFAULT__"
|
int |
getDefaultCacheTimeout()
默认缓存数据超时时间(秒),可选参数,数值必须大于等于0,默认值为0
|
ICacheKeyGenerator<?> |
getKeyGenerator()
缓存Key生成器,可选参数,默认值为 net.ymate.platform.cache.impl.DefaultCacheKeyGenerator
|
ISerializer |
getSerializer()
对象序列化接口实现,可选参数,默认值为 SerializerManager.getDefaultSerializer()
|
void |
initialize(ICaches owner)
初始化
|
boolean |
isEnabledSubscribeExpired()
是否开启Redis订阅缓存元素过期事件,可选参数,默认值为false
|
boolean |
isInitialized()
是否已初始化
|
boolean |
isMultilevelSlavesAutoSync()
Multilevel模式下是否自动同步Master和Slave级缓存,可选参数,默认值为false
|
boolean |
isStorageWithSet()
是否采用Set存储缓存键名
|
void |
setCacheEventListener(ICacheEventListener cacheEventListener) |
void |
setCacheProvider(ICacheProvider cacheProvider) |
void |
setCacheScopeProcessor(ICacheScopeProcessor cacheScopeProcessor) |
void |
setConfigFile(File configFile) |
void |
setDefaultCacheName(String defaultCacheName) |
void |
setDefaultCacheTimeout(int defaultCacheTimeout) |
void |
setEnabledSubscribeExpired(boolean enabledSubscribeExpired) |
void |
setKeyGenerator(ICacheKeyGenerator<?> keyGenerator) |
void |
setMultilevelSlavesAutoSync(boolean multilevelSlavesAutoSync) |
void |
setSerializer(ISerializer serializer) |
void |
setStorageWithSet(boolean storageWithSet) |
public static DefaultCacheConfig defaultConfig()
public static DefaultCacheConfig create(IModuleConfigurer moduleConfigurer)
public static DefaultCacheConfig create(Class<?> mainClass, IModuleConfigurer moduleConfigurer)
public static DefaultCacheConfig.Builder builder()
public void initialize(ICaches owner) throws Exception
IInitializationinitialize in interface IInitialization<ICaches>owner - 指定所属容器参数对象Exception - 初始过程中产生的任何异常public boolean isInitialized()
IInitializationisInitialized in interface IInitialization<ICaches>public ICacheProvider getCacheProvider()
ICacheConfiggetCacheProvider in interface ICacheConfigpublic void setCacheProvider(ICacheProvider cacheProvider)
public ICacheEventListener getCacheEventListener()
ICacheConfiggetCacheEventListener in interface ICacheConfigpublic void setCacheEventListener(ICacheEventListener cacheEventListener)
public ICacheScopeProcessor getCacheScopeProcessor()
ICacheConfiggetCacheScopeProcessor in interface ICacheConfigpublic void setCacheScopeProcessor(ICacheScopeProcessor cacheScopeProcessor)
public ICacheKeyGenerator<?> getKeyGenerator()
ICacheConfiggetKeyGenerator in interface ICacheConfigpublic void setKeyGenerator(ICacheKeyGenerator<?> keyGenerator)
public ISerializer getSerializer()
ICacheConfiggetSerializer in interface ICacheConfigpublic void setSerializer(ISerializer serializer)
public String getDefaultCacheName()
ICacheConfiggetDefaultCacheName in interface ICacheConfigpublic void setDefaultCacheName(String defaultCacheName)
public int getDefaultCacheTimeout()
ICacheConfiggetDefaultCacheTimeout in interface ICacheConfigpublic File getConfigFile()
ICacheConfiggetConfigFile in interface ICacheConfigpublic void setConfigFile(File configFile)
public void setDefaultCacheTimeout(int defaultCacheTimeout)
public boolean isStorageWithSet()
ICacheConfigisStorageWithSet in interface ICacheConfigpublic void setStorageWithSet(boolean storageWithSet)
public boolean isEnabledSubscribeExpired()
ICacheConfigisEnabledSubscribeExpired in interface ICacheConfigpublic void setEnabledSubscribeExpired(boolean enabledSubscribeExpired)
public boolean isMultilevelSlavesAutoSync()
ICacheConfigisMultilevelSlavesAutoSync in interface ICacheConfigpublic void setMultilevelSlavesAutoSync(boolean multilevelSlavesAutoSync)
Copyright © 2022. All rights reserved.