Why are the most recently loaded users removed from the cache? #1822
-
In my test, I have 100 users in the database. The MaximumSize of my cache is 50. Then I get the users as following:
I noticed that the recenty loaded users are removed from the cache: 10:23:45.112 INFO ForkJoinPool.commonPool-worker-1 (CacheFactory.java:106) - CACHE: insert: Users | 2056 : [2056,TestUser_qstaix84_32]
How could I prevent it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You would need to simulate some cache activity for the recently users. Otherwise one-hit wonders can pollute an LRU cache, so more aggressive eviction of new entries helps in mru / lfu workloads. If there is no or uniform distribution of hits then the cache can’t make an intelligent choice and anything is reasonable. The learning policy tries to maximize the hit rate and doesn’t bias for recency if all else equal. |
Beta Was this translation helpful? Give feedback.
You would need to simulate some cache activity for the recently users. Otherwise one-hit wonders can pollute an LRU cache, so more aggressive eviction of new entries helps in mru / lfu workloads. If there is no or uniform distribution of hits then the cache can’t make an intelligent choice and anything is reasonable. The learning policy tries to maximize the hit rate and doesn’t bias for recency if all else equal.