Liking cljdoc? Tell your friends :D

com.wsscode.pathom3.cache


cache-findclj/s

(cache-find cache cache-key)

Read from cache, without trying to set.

Read from cache, without trying to set.
sourceraw docstring

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 be 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 be a function of zero arguments.

Example:

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

CacheStoreclj/sprotocol

-cache-findclj/s

(-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 the distinction between a miss (nil return) vs a value with a miss (a map-entry with a value of nil)

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
the distinction between a miss (nil return) vs a value with a miss (a map-entry with
a value of nil)

-cache-lookup-or-missclj/s

(-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.

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.
source

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

× close