CacheManager cacheManager = CacheManager.create(); Cache cache = new Cache("myCache", 1000, true, false, 3600, 1800); cacheManager.addCache(cache); Cache cache = new Cache("myCache", 1000, true, false, 3600, 1800); cache.setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy.LRU); Cache cache = cacheManager.getCache("myCache"); cache.put(new Element("key1", "value1")); Element element = cache.get("key1"); cache.remove("key1"); <ehcache> <cache name="myCache" maxEntriesLocalHeap="1000" eternal="false" timeToIdleSeconds="3600" timeToLiveSeconds="1800" overflowToDisk="true" diskSpoolBufferSizeMB="30" diskPersistent="false" memoryStoreEvictionPolicy="LRU" statistics="true"/> </ehcache>


上一篇:
下一篇:
切换中文