<< Back to previous view

[CCACHE-26] hit function in LRU cache can give funny results Created: 22/Aug/12  Updated: 04/Aug/14  Resolved: 04/Aug/14

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   

A common-sense usage in caches is hit/get. But if I naively do this to an LRUCache, without checking first for the presence of the key, I can break the limit.

(-> (cache/lru-cache-factory {} :threshold 2)
(cache/hit :x)
(cache/hit :y)
(cache/hit :z)
(assoc :a 1)
(assoc :b 2)
(assoc :c 3)
(assoc :d 4)
(assoc :e 5))

; {:e 5, :d 4, :c 3, :b 2, :a 1}



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 04/Aug/14 11:04 PM ]

Fixed https://github.com/clojure/core.cache/commit/a77b003d6593f7bde2f27f03ec52310b68aa0ea6

Generated at Sat Dec 20 14:59:10 CST 2014 using JIRA 4.4#649-r158309.