hit function in LRU cache can give funny results

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}

Environment

None

Activity

Show:
Sean Corfield
March 1, 2018, 4:50 AM

Closing out all resolved issues as of 0.6.5 in order to track the next release.

Completed

Assignee

Fogus

Reporter

import

Labels

None

Approval

None

Patch

None

Priority

Major