List of usage examples for org.apache.commons.cache LRUEvictionPolicy LRUEvictionPolicy
public LRUEvictionPolicy()
From source file:com.adito.policyframework.PrincipalCache.java
protected final Cache createCache(String messageBundle, String cacheFullText) { File cacheDirectory = new File(ContextHolder.getContext().getTempDirectory(), "cache"); File cacheTypeDirectory = new File(cacheDirectory, cacheType); Stash stash = inMemoryCache ? new MemoryStash(cacheSize) : new FileStash(Long.MAX_VALUE, cacheSize, new File[] { cacheTypeDirectory }, true); // eviction can't be used in testing as the policy creates a thread // which is only stopped on JVM exit, hence breaking the tests boolean isTestMode = "true".equals(SystemProperties.get("adito.testing", "false")); EvictionPolicy evictionPolicy = isTestMode ? null : new LRUEvictionPolicy(); SimpleCache cache = new SimpleCache(stash, evictionPolicy, null, new GroupMapImpl()); cache.registerStorageListener(getStorageListener(messageBundle, cacheFullText)); return cache; }
From source file:com.sslexplorer.policyframework.PrincipalCache.java
protected final Cache createCache(String messageBundle, String cacheFullText) { File cacheDirectory = new File(ContextHolder.getContext().getTempDirectory(), "cache"); File cacheTypeDirectory = new File(cacheDirectory, cacheType); Stash stash = inMemoryCache ? new MemoryStash(cacheSize) : new FileStash(Long.MAX_VALUE, cacheSize, new File[] { cacheTypeDirectory }, true); // eviction can't be used in testing as the policy creates a thread // which is only stopped on JVM exit, hence breaking the tests boolean isTestMode = "true".equals(SystemProperties.get("sslexplorer.testing", "false")); EvictionPolicy evictionPolicy = isTestMode ? null : new LRUEvictionPolicy(); SimpleCache cache = new SimpleCache(stash, evictionPolicy, null, new GroupMapImpl()); cache.registerStorageListener(getStorageListener(messageBundle, cacheFullText)); return cache; }