core.cache

LRU and LU caches never evict entries that came in as a seed and are never accessed

Details

  • Type: Defect Defect
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:

Description

If one initializes an LRU or LU cache with seed data and those datum are never touched, then they are never evicted.

  (def C (lru-cache-factory {:a 1, :b 2} :limit 2))
  
  (-> C (assoc :c 3) (assoc :d 4) (assoc :e 5))

You would expect that the cache should contain only :d and :e, but it instead includes :a, :b, :d and :e! The problem is that seeds are never added to the eviction queue.

Activity

Fogus made changes -
Field Original Value New Value
Resolution Completed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Fogus made changes -
Description If one initializes an LRU or LU cache with seed data and those datum are never touched, then they are never evicted.

{{noformat}}
  (def C (lru-cache-factory {:a 1, :b 2} :limit 2))
  
  (-> C (assoc :c 3) (assoc :d 4) (assoc :e 5))
{{noformat}}

You would expect that the cache should contain only {{:d}} and {{:e}}, but it instead includes {{:a}}, {{:b}}, {{:d}} and {{:e}}! The problem is that seeds are never added to the eviction queue.
If one initializes an LRU or LU cache with seed data and those datum are never touched, then they are never evicted.

{noformat}
  (def C (lru-cache-factory {:a 1, :b 2} :limit 2))
  
  (-> C (assoc :c 3) (assoc :d 4) (assoc :e 5))
{noformat}

You would expect that the cache should contain only {{:d}} and {{:e}}, but it instead includes {{:a}}, {{:b}}, {{:d}} and {{:e}}! The problem is that seeds are never added to the eviction queue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: