Add lru-cache module: LinkedHashMap and hand-rolled DLL LRU, coarse-lock/striped thread-safe variants, broken ReadWriteLock demo, Caffeine reference, 43 tests, JMH harness
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4VQVEJWetTT1dYzyJ
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
StripedLruCache(capacity 4, 2 stripes): even keys -> stripe 0, odd keys -> stripe 1
|
||||
===================================================================================
|
||||
|
||||
put(1) put(0) put(2) put(4) // key 1 is the globally least recently used
|
||||
get(0) -> null (evicted: stripe 0 held {0,2} and was full)
|
||||
get(1) -> present (a strict global LRU would have evicted it instead)
|
||||
size() = 3 of capacity 4 (evicted while not full)
|
||||
Reference in New Issue
Block a user