[CCACHE-23] Overwriting entries in LRU-cache deletes LRU key-values unnecessarily Created: 22/Jun/12 Updated: 22/Aug/12 Resolved: 13/Jul/12 |
|
| Status: | Resolved |
| Project: | core.cache |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Arthur Edelstein | Assignee: | Fogus |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
To "overwrite" the value in an LRUCache, one uses assoc. Surprisingly, another k,v entry is evicted, even though the total number of items in the cache should not be increased by overwriting. Demo: (def C0 (lru-cache-factory {} :threshold 3)) (def C1 (-> C0 (assoc :a 1) (assoc :b 2) (assoc :c 3))) (-> C1 (assoc :a 4) (assoc :a 5) (assoc :a 6)) |
| Comments |
| Comment by Fogus [ 12/Jul/12 6:40 AM ] |
|
I've pushed a commit to master that I believe fixes this problem. I'll look at it a bit more and will release a v0.6.1 version ASAP. |
| Comment by Fogus [ 12/Jul/12 3:24 PM ] |
|
version 0.6.1 has been pushed out to Maven central. |
| Comment by Fogus [ 13/Jul/12 10:46 AM ] |
|
v0.6.1 pushed to Maven Central. |
| Comment by Si Yu [ 16/Jul/12 1:30 PM ] |
|
It appears v0.6.1 still has not fixed the issue (-> (cache/lru-cache-factory {} :threshold 2) |
| Comment by Arthur Edelstein [ 22/Aug/12 7:28 PM ] |
|
Works for me in 0.6.2. Thanks, Fogus! (-> (cache/lru-cache-factory {} :threshold 2) ; {:b 3, :a 1} |