Я использую политику LRU Ehcache 2.8.8 в своем веб-приложении, когда нет -Dnet.sf.ehcache.use.classic.lru=true Ehcache учитывает мой параметр maxBytesLocalHeap; но этого не происходит, когда установлено системное свойство.
В кэше классов:
if (useClassicLru && onfiguration.getMemoryStoreEvictionPolicy().
equals(MemoryStoreEvictionPolicy.LRU)) {
Store disk = createDiskStore();
store = new LegacyStoreWrapper(new LruMemoryStore(this, disk),
disk, registeredEventListeners, configuration);
} else {
if (configuration.isOverflowToDisk()) {
store = DiskStore.createCacheStore(this, onHeapPool,
onDiskPool);
} else {
store = MemoryStore.create(this, onHeapPool);
}
}
И в классе LruMemoryStore:
public LruMemoryStore(Ehcache cache, Store diskStore) {
status = Status.STATUS_UNINITIALISED;
this.maximumSize =
cache.getCacheConfiguration().getMaxEntriesLocalHeap();
this.cachePinned =
determineCachePinned(cache.getCacheConfiguration());
this.elementPinningEnabled =
!cache.getCacheConfiguration().isOverflowToOffHeap();
this.cache = cache;
this.diskStore = diskStore;
if (cache.getCacheConfiguration().isOverflowToDisk()) {
evictionObserver = null;
} else {
evictionObserver =
StatisticBuilder.operation(EvictionOutcome.class).
named("eviction").of(this).build();
}
map = new SpoolingLinkedHashMap();
status = Status.STATUS_ALIVE;
copyStrategyHandler = MemoryStore.getCopyStrategyHandler(cache);
}
Итак, я думаю, действует только MaxEntriesLocalHeap?
Можно ли установить его как системное свойство jvm?