本文整理汇总了Java中net.sf.ehcache.config.Configuration.setUpdateCheck方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.setUpdateCheck方法的具体用法?Java Configuration.setUpdateCheck怎么用?Java Configuration.setUpdateCheck使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.ehcache.config.Configuration
的用法示例。
在下文中一共展示了Configuration.setUpdateCheck方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: internalCreateCacheManager
import net.sf.ehcache.config.Configuration; //导入方法依赖的package包/类
/**
* Actual creation of the singleton.
*
* @param config
* the parsed EhCache configuration
* @return the cache manager
* @throws CacheException
* in case the creation failed
*/
private static synchronized CacheManager internalCreateCacheManager(Configuration config)
throws CacheException {
if (SINGLETON != null) {
extendEhCacheWithCustomConfig(SINGLETON, config);
} else {
// for better control over the files created by the application override the diskstore
// path
// for flushing cached data to disk
overrideDiskStorePath(config);
// disable the update check
config.setUpdateCheck(false);
SINGLETON = new CacheManager(config);
}
return SINGLETON;
}
示例2: createTestCacheManager
import net.sf.ehcache.config.Configuration; //导入方法依赖的package包/类
/**
* Creates a unique cache manager.
*
* @param uniqueName the unique name, typically a test case class name
* @return the unique cache manager, not null
*/
public static CacheManager createTestCacheManager(String uniqueName) {
ArgumentChecker.notNull(uniqueName, "uniqueName");
if (UNIQUE_TEST_NAMES.putIfAbsent(uniqueName, uniqueName) != null) {
throw new OpenGammaRuntimeException("CacheManager has already been created with unique name: " + uniqueName);
}
try {
InputStream configStream = getTestEhCacheConfig();
Configuration config = ConfigurationFactory.parseConfiguration(configStream);
config.setName(uniqueName);
config.setUpdateCheck(false);
return CacheManager.newInstance(config);
} catch (CacheException ex) {
throw new OpenGammaRuntimeException("Unable to create CacheManager", ex);
}
}
示例3: getEhCacheConfig
import net.sf.ehcache.config.Configuration; //导入方法依赖的package包/类
private static synchronized Configuration getEhCacheConfig() {
String ehcacheConfigFile = DEFAULT_EHCACHE_CONFIG_FILE;
String overrideEhcacheConfigFile = System.getProperty("ehcache.config"); // passed in by Ant
if (overrideEhcacheConfigFile != null) {
ehcacheConfigFile = overrideEhcacheConfigFile;
System.err.println("Using ehcache.config from system property: " + ehcacheConfigFile);
} else {
System.err.println("Using default ehcache.config file name: " + ehcacheConfigFile);
}
try (InputStream resource = EHCacheUtils.class.getResourceAsStream(ehcacheConfigFile)) {
Configuration config = ConfigurationFactory.parseConfiguration(resource);
config.setUpdateCheck(false);
return config;
} catch (IOException ex) {
throw new OpenGammaRuntimeException("Unable to read ehcache file", ex);
}
}
示例4: afterPropertiesSet
import net.sf.ehcache.config.Configuration; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public void afterPropertiesSet() throws Exception {
Cache.ID = key + "." + Dates.newDateStringOfFormatDateTimeSSSNoneSpace();
Cache.HOST = Utils.getLocalHostIP();
Cache.CACHE_STORE = key + spliter + "cache" + spliter + "store";
Cache.CACHE_STORE_SYNC = Cache.CACHE_STORE + spliter + "sync";
if (this.localEnabled) {
Configuration configuration = new Configuration();
configuration.setName(Cache.ID);
configuration.setMaxBytesLocalHeap(localMaxBytesLocalHeap);
configuration.setMaxBytesLocalDisk(localMaxBytesLocalDisk);
// DiskStore
// 每次启动设置新的文件地址,以避免重启期间一级缓存未同步,以及单机多应用启动造成EhcacheManager重复的问题.
DiskStoreConfiguration dsc = new DiskStoreConfiguration();
dsc.setPath(localStoreLocation + Cache.ID);
configuration.diskStore(dsc);
// DefaultCache
CacheConfiguration defaultCacheConfiguration = new CacheConfiguration();
defaultCacheConfiguration.setEternal(false);
defaultCacheConfiguration.setOverflowToDisk(true);
defaultCacheConfiguration.setDiskPersistent(false);
defaultCacheConfiguration.memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LRU);
defaultCacheConfiguration.setDiskExpiryThreadIntervalSeconds(localDiskExpiryThreadIntervalSeconds);
// 默认false,使用引用.设置为true,避免外部代码修改了缓存对象.造成EhCache的缓存对象也随之改变
// 但是设置为true后,将引起element的tti不自动刷新.如果直接新建element去覆盖原值.则本地ttl和远程ttl会产生一定的误差.
// 因此,使用时放弃手动覆盖方式刷新本地tti,当本地tti过期后,自动从Redis中再获取即可.
defaultCacheConfiguration.copyOnRead(true);
defaultCacheConfiguration.copyOnWrite(true);
defaultCacheConfiguration.setTimeToIdleSeconds(localTimeToIdleSeconds);
defaultCacheConfiguration.setTimeToLiveSeconds(localTimeToLiveSeconds);
configuration.setDefaultCacheConfiguration(defaultCacheConfiguration);
configuration.setDynamicConfig(false);
configuration.setUpdateCheck(false);
this.cacheManager = new CacheManager(configuration);
this.cacheSync = new RedisPubSubSync(this);// 使用Redis Topic发送订阅缓存变更消息
}
}
示例5: createCacheManager
import net.sf.ehcache.config.Configuration; //导入方法依赖的package包/类
private CacheManager createCacheManager() throws UnsupportedEncodingException {
Configuration configuration = new Configuration();
configuration.setUpdateCheck(false);
configuration.addDiskStore(diskStore());
configuration.setDefaultCacheConfiguration(new CacheConfiguration("cache", 10000));
return new CacheManager(configuration);
}
示例6: provideCacheManager
import net.sf.ehcache.config.Configuration; //导入方法依赖的package包/类
@Provides
@Singleton
public CacheManager provideCacheManager() {
Configuration configuration = new Configuration();
configuration.setName("LDACEhCacheManager");
configuration.setUpdateCheck(false);
return CacheManager.create(configuration);
}
示例7: LocalCache
import net.sf.ehcache.config.Configuration; //导入方法依赖的package包/类
private LocalCache() {
Configuration escacheConf = new Configuration();
escacheConf.setUpdateCheck(conf.updateCheck);
cacheManager = CacheManager.create(escacheConf);
}