We're updating the issue view to help you get more done. 

Suggested usage subject to Cache Stampede

Description

I've been trying to wrap my head around core.cache, and it seems to me that the suggest use in the documentation, i.e.

1 2 3 4 5 6 (defn get-data [key] (cache/lookup (swap! cache-store #(if (cache/has? % key) (cache/hit % key) (cache/miss % key (retrieve-data key)))) key))

will result in a Cache Stampede since (retrieve-data key) might be called multiple times if swap! retries due to compare-and-swap misses. Unfortunately I don't have a suggestion on how this could be fixed.

Environment

None

Status

Assignee

Sean Corfield

Reporter

import

Labels

None

Approval

None

Patch

None

Priority

Major