本文整理汇总了Java中net.sf.ehcache.config.CacheConfiguration.setStatistics方法的典型用法代码示例。如果您正苦于以下问题:Java CacheConfiguration.setStatistics方法的具体用法?Java CacheConfiguration.setStatistics怎么用?Java CacheConfiguration.setStatistics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.ehcache.config.CacheConfiguration
的用法示例。
在下文中一共展示了CacheConfiguration.setStatistics方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCacheConfiguration
import net.sf.ehcache.config.CacheConfiguration; //导入方法依赖的package包/类
/**
* Read cache config from the file caches.dat
*
* @param strCacheName
* The cache name
* @return The config
*/
private CacheConfiguration getCacheConfiguration( String strCacheName )
{
CacheConfiguration config = new CacheConfiguration( );
config.setName( strCacheName );
config.setMaxElementsInMemory( getIntProperty( strCacheName, PROPERTY_MAX_ELEMENTS, _nDefaultMaxElementsInMemory ) );
config.setEternal( getBooleanProperty( strCacheName, PROPERTY_ETERNAL, _bDefaultEternal ) );
config.setTimeToIdleSeconds( getLongProperty( strCacheName, PROPERTY_TIME_TO_IDLE, _lDefaultTimeToIdle ) );
config.setTimeToLiveSeconds( getLongProperty( strCacheName, PROPERTY_TIME_TO_LIVE, _lDefaultTimeToLive ) );
config.setOverflowToDisk( getBooleanProperty( strCacheName, PROPERTY_OVERFLOW_TO_DISK, _bDefaultOverflowToDisk ) );
config.setDiskPersistent( getBooleanProperty( strCacheName, PROPERTY_DISK_PERSISTENT, _bDefaultDiskPersistent ) );
config.setDiskExpiryThreadIntervalSeconds( getLongProperty( strCacheName, PROPERTY_DISK_EXPIRY, _lDefaultDiskExpiry ) );
config.setMaxElementsOnDisk( getIntProperty( strCacheName, PROPERTY_MAX_ELEMENTS_DISK, _nDefaultMaxElementsOnDisk ) );
config.setStatistics( getBooleanProperty( strCacheName, PROPERTY_STATISTICS, _bDefaultStatistics ) );
return config;
}
示例2: tweakCacheConfiguration
import net.sf.ehcache.config.CacheConfiguration; //导入方法依赖的package包/类
private static CacheConfiguration tweakCacheConfiguration(CacheConfiguration cacheConfiguration) {
// Make copies of cached objects (use default Serializable copy)
cacheConfiguration.setCopyOnRead(true);
cacheConfiguration.setCopyOnWrite(true);
cacheConfiguration.setStatistics(true);
return cacheConfiguration;
}
示例3: tweakCacheConfiguration
import net.sf.ehcache.config.CacheConfiguration; //导入方法依赖的package包/类
private CacheConfiguration tweakCacheConfiguration(CacheConfiguration cacheConfiguration) {
// Set searchable index
Searchable uidToDocumentCacheSearchable = new Searchable();
uidToDocumentCacheSearchable.addSearchAttribute(new SearchAttribute().name("ObjectId")
.expression("value.getObjectId().toString()"));
uidToDocumentCacheSearchable.addSearchAttribute(new SearchAttribute().name("VersionFromInstant")
.className("com.opengamma.master.cache.InstantExtractor"));
uidToDocumentCacheSearchable.addSearchAttribute(new SearchAttribute().name("VersionToInstant")
.className("com.opengamma.master.cache.InstantExtractor"));
uidToDocumentCacheSearchable.addSearchAttribute(new SearchAttribute().name("CorrectionFromInstant")
.className("com.opengamma.master.cache.InstantExtractor"));
uidToDocumentCacheSearchable.addSearchAttribute(new SearchAttribute().name("CorrectionToInstant")
.className("com.opengamma.master.cache.InstantExtractor"));
cacheConfiguration.addSearchable(uidToDocumentCacheSearchable);
// Make copies of cached objects
CopyStrategyConfiguration copyStrategyConfiguration = new CopyStrategyConfiguration();
copyStrategyConfiguration.setClass("com.opengamma.master.cache.JodaBeanCopyStrategy");
cacheConfiguration.addCopyStrategy(copyStrategyConfiguration);
cacheConfiguration.setCopyOnRead(true);
cacheConfiguration.setCopyOnWrite(true);
cacheConfiguration.setStatistics(true);
return cacheConfiguration;
}