Revision af15e2e3
Added by Andreas Müller over 1 year ago
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCachingProxy.java | ||
---|---|---|
34 | 34 |
import net.sf.ehcache.config.CacheConfiguration; |
35 | 35 |
import net.sf.ehcache.config.DiskStoreConfiguration; |
36 | 36 |
import net.sf.ehcache.config.SizeOfPolicyConfiguration; |
37 |
import net.sf.ehcache.store.MemoryStoreEvictionPolicy; |
|
37 | 38 |
|
38 | 39 |
/** |
39 | 40 |
* Class which uses CDM services to cache cdm entities |
... | ... | |
77 | 78 |
cacheLoader = new CacheLoader(this); |
78 | 79 |
} |
79 | 80 |
|
81 |
//FIXME #10218 setting up the cache manager here probably has no effect |
|
82 |
// as described in #10214 |
|
80 | 83 |
private void setUpCacheManager() { |
81 | 84 |
|
82 | 85 |
DiskStoreConfiguration diskStoreConfiguration = new DiskStoreConfiguration(); |
... | ... | |
107 | 110 |
|
108 | 111 |
@Override |
109 | 112 |
protected CacheConfiguration getPermanentCacheConfiguration() { |
113 |
|
|
110 | 114 |
// For a better understanding on how to size caches, refer to |
111 |
// http://ehcache.org/documentation/configuration/cache-size
|
|
115 |
// https://www.ehcache.org/documentation/2.8/configuration/cache-size.html
|
|
112 | 116 |
|
117 |
//probably size of policy configuration is not really needed here |
|
113 | 118 |
SizeOfPolicyConfiguration sizeOfConfig = new SizeOfPolicyConfiguration(); |
114 | 119 |
sizeOfConfig.setMaxDepth(100); |
115 | 120 |
sizeOfConfig.setMaxDepthExceededBehavior("abort"); |
116 | 121 |
|
117 |
return new CacheConfiguration(PERMANENT_CACHE_NAME, 0) |
|
118 |
.eternal(true) |
|
119 |
.sizeOfPolicy(sizeOfConfig) |
|
120 |
.overflowToOffHeap(false); |
|
122 |
CacheConfiguration config = new CacheConfiguration(PERMANENT_CACHE_NAME, 1000) |
|
123 |
.memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU) |
|
124 |
.eternal(false) |
|
125 |
.sizeOfPolicy(sizeOfConfig) |
|
126 |
// default ttl and tti set to 1 hour and 20 min |
|
127 |
.timeToLiveSeconds(60*60*1) |
|
128 |
.timeToIdleSeconds(60*20); |
|
129 |
return config; |
|
121 | 130 |
} |
122 | 131 |
|
123 | 132 |
@Override |
Also available in: Unified diff
fix #10214 fix overriden cache configuration creation, replace eternal by 1h / 20min