November 2018
Beginner to intermediate
260 pages
6h 12m
English
This removes the least recently used entries from the cache. You need to enable on-heap caching in the cache configuration and set LruEvictionPolicyFactory as the eviction policy. LruEvictionPolicyFactory needs to know about the maximum number of entries to keep on-heap:
CacheConfiguration<Long, String> cacheCfg = new CacheConfiguration<>();// Enabling on-heap caching for this distributed cache. cacheCfg.setOnheapCacheEnabled(true); // Set the maximum cache size to 10,000 (default is 100,000). cacheCfg.setEvictionPolicyFactory(new LruEvictionPolicyFactory<>(10000));
Read now
Unlock full access