Java 类net.sf.ehcache.config.PersistenceConfiguration.Strategy 实例源码

项目:xsharing-services-router    文件:EhCacheWrapper.java   
/**
 * http://www.ehcache.org/documentation/2.8/code-samples.html#creating-caches-programmatically
 */
EhCacheWrapper(String cacheName) {
    AppConfiguration.Cache config = AppConfiguration.CONFIG.getCache();

    // Create a Cache specifying its configuration
    cache = new Cache(
            new CacheConfiguration(cacheName, config.getMaxSize())
                    .timeToLiveSeconds(TimeUnit.MINUTES.toSeconds(config.getLifeTime()))
                    .eternal(false)
                    .persistence(new PersistenceConfiguration().strategy(Strategy.NONE))
                    .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.FIFO)
    );

    // The cache is not usable until it has been added
    manager.addCache(cache);
}
项目:xslweb    文件:WebApp.java   
public void setCacheValue(String cacheName, String keyName, Collection<Attribute> attrs, int tti, int ttl) {
  CacheManager manager = Context.getInstance().getCacheManager();
  Cache cache = manager.getCache(cacheName);
  if (cache == null) {      
    cache = new Cache(
        new CacheConfiguration(cacheName, 1000)
          .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LRU)
          .eternal(false)
          .timeToLiveSeconds(60)
          .timeToIdleSeconds(60)
          .diskExpiryThreadIntervalSeconds(120)
          .persistence(new PersistenceConfiguration().strategy(Strategy.LOCALTEMPSWAP)));
    manager.addCache(cache);
  }            
  cache.put(new net.sf.ehcache.Element(keyName, attrs, false, tti, ttl));
}
项目:rapidminer-onomastics-extension    文件:ExtractOriginOperator.java   
private Cache getOrCreateCache() {
    // Create a singleton CacheManager using defaults
    CacheManager manager = CacheManager.create();
    // Create a Cache specifying its configuration
    Cache c = manager.getCache(CACHE_name);
    if (c == null) {
        c = new Cache(new CacheConfiguration(CACHE_name,
                CACHE_maxEntriesLocalHeap)
                .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
                .eternal(true)
                .persistence(
                        new PersistenceConfiguration()
                                .strategy(Strategy.LOCALTEMPSWAP)));
        manager.addCache(c);
    }
    return c;
}
项目:rapidminer-onomastics-extension    文件:ParseNameOperator.java   
private Cache getOrCreateCache() {
    // Create a singleton CacheManager using defaults
    CacheManager manager = CacheManager.create();
    // Create a Cache specifying its configuration
    Cache c = manager.getCache(CACHE_name);
    if (c == null) {
        c = new Cache(new CacheConfiguration(CACHE_name,
                CACHE_maxEntriesLocalHeap)
                .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
                .eternal(true)
                .persistence(
                        new PersistenceConfiguration()
                                .strategy(Strategy.LOCALTEMPSWAP)));
        manager.addCache(c);
    }
    return c;
}
项目:rapidminer-onomastics-extension    文件:ExtractGenderOperator.java   
private Cache getOrCreateCache() {
    // Create a singleton CacheManager using defaults
    CacheManager manager = CacheManager.create();
    // Create a Cache specifying its configuration
    Cache c = manager.getCache(CACHE_name);
    if (c == null) {
        c = new Cache(new CacheConfiguration(CACHE_name,
                CACHE_maxEntriesLocalHeap)
                .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
                .eternal(true)
                .persistence(
                        new PersistenceConfiguration()
                                .strategy(Strategy.LOCALTEMPSWAP)));
        manager.addCache(c);
    }
    return c;
}
项目:afp-api-client    文件:AFPDataGrabberCache.java   
public RealCache() {
    super();
    CacheManager manager = null;
    synchronized (RealCache.class) {
        manager = CacheManager.getInstance();
        if (!manager.cacheExists("AFPDataGrabberCache")) {
            Cache cache = new Cache(new CacheConfiguration("AFPDataGrabberCache", 50000).memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
                    .eternal(true).timeToLiveSeconds(0).timeToIdleSeconds(0).persistence(new PersistenceConfiguration().strategy(Strategy.NONE)));
            manager.addCache(cache);
        }
    }
    ehcache = manager.getCache("AFPDataGrabberCache");
}
项目:jerseyoauth2    文件:DefaultCacheManagerProvider.java   
public DefaultCacheManagerProvider()
{
    net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration();
    config.setUpdateCheck(false);
    CacheConfiguration tokenCacheConfiguration = new CacheConfiguration().
            maxEntriesLocalHeap(DEFAULT_MAX_CACHE_ENTRIES).
            name("tokenCache").
            persistence(new PersistenceConfiguration().strategy(Strategy.NONE));
    tokenCacheConfiguration.validateConfiguration();
    config.addCache(tokenCacheConfiguration );
    cacheManager = CacheManager.create(config);
}
项目:sdcct    文件:CacheFactoryBean.java   
@Nullable
public Strategy getPersistenceStrategy() {
    return this.persistenceStrategy;
}
项目:sdcct    文件:CacheFactoryBean.java   
public void setPersistenceStrategy(@Nullable Strategy persistenceStrategy) {
    this.persistenceStrategy = persistenceStrategy;
}
项目:crigtt    文件:CrigttCacheFactoryBean.java   
public Strategy getPersistenceStrategy() {
    return this.persistenceStrategy;
}
项目:crigtt    文件:CrigttCacheFactoryBean.java   
public void setPersistenceStrategy(Strategy persistenceStrategy) {
    this.persistenceStrategy = persistenceStrategy;
}