本文整理匯總了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);
}