Skip to content

Commit

Permalink
Add docstring for -cache-lookup-or-miss method on CacheStore
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkerlucio committed Oct 29, 2023
1 parent 55ccc17 commit 5de7cc0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/com/wsscode/pathom3/cache.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
Volatile))))

(defprotocol CacheStore
(-cache-lookup-or-miss [this cache-key f])
(-cache-lookup-or-miss [this cache-key f]
"Implement the main functionality of a cache, this receives a cache key and a function
that computes the value in case its uncached. When cache misses, the implementation
should run f to compute the result and cache it. This method should always return a
value (reading from cache or calling f). A cache store can also support async, in such
cases it's ok for the cache store to return a promise.")
(-cache-find [this cache-key]
"Implement a way to read a cache key from the cache. If there is a hit, you must
return a map entry for the result, otherwise return nil. The map-entry can make
Expand Down

0 comments on commit 5de7cc0

Please sign in to comment.