Created
July 1, 2014 02:49
-
-
Save mpellegrini/233c2318a5555e8e53ac to your computer and use it in GitHub Desktop.
Creating Ehcache Programmatically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a configuration | |
Configuration configuration = new Configuration(); | |
//Create a CacheManager using defaults | |
CacheManager manager = CacheManager.create(configuration); | |
//Create a Cache specifying its configuration. | |
Cache testCache = new Cache( | |
new CacheConfiguration("test", maxElements) | |
.memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU) | |
.overflowToDisk(true) | |
.eternal(false) | |
.timeToLiveSeconds(60) | |
.timeToIdleSeconds(30) | |
.diskPersistent(false) | |
.diskExpiryThreadIntervalSeconds(0)); | |
manager.addCache(cache); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment