Liking cljdoc? Tell your friends :D

com.wsscode.pathom3.cache


cache-store?clj/s

(cache-store? x)
source

cachedclj/s

(cached cache-container env cache-key f)

Try to read some value from a cache, otherwise run and cache it.

cache-container is a keyword for the cache container name, consider that the environment has multiple cache atoms. If the cache-container key is not present in the env, the cache will be ignored and will always run f.

cache-key is how you decide, in that cache container, what key should be used for this cache try.

f needs to a function of zero arguments.

Example:

(cached ::my-cache {::my-cache (atom {})} [3 :foo]
  (fn [] (run-expensive-operation)))
Try to read some value from a cache, otherwise run and cache it.

cache-container is a keyword for the cache container name, consider that the environment
has multiple cache atoms. If the cache-container key is not present in the env, the
cache will be ignored and will always run f.

cache-key is how you decide, in that cache container, what key should be used for
this cache try.

f needs to a function of zero arguments.

Example:

    (cached ::my-cache {::my-cache (atom {})} [3 :foo]
      (fn [] (run-expensive-operation)))
sourceraw docstring

CacheStoreclj/sprotocol

-cache-lookup-or-missclj/s

(-cache-lookup-or-miss this cache-key f)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close