Memoization library.
Memoization library.
(active-cache f)
Return Cache instance from the function, if present.
Return Cache instance from the function, if present.
(as-map f)
Return a map representation of the memoized entries on this function.
Return a map representation of the memoized entries on this function.
(bind fn-or-var mount-conf cache)
Bind the cache to a function or a var. If a var is specified, then var root binding is modified.
The mount-conf is a configuration options for mount point.
It can be a map with options, a vector of tags, or one tag.
Supported options are:
Bind the cache to a function or a var. If a var is specified, then var root binding is modified. The mount-conf is a configuration options for mount point. It can be a map with options, a vector of tags, or one tag. Supported options are: - memento.core/key-fn - memento.core/ret-fn - memento.core/tags - memento.core/seed
(create conf)
Create a cache.
A conf is a map of cache settings, see memento.config namespace for names of settings.
Create a cache. A conf is a map of cache settings, see memento.config namespace for names of settings.
(do-not-cache v)
Wrap a function result value in a wrapper that tells the Cache not to cache this particular value.
Wrap a function result value in a wrapper that tells the Cache not to cache this particular value.
(memo fn-or-var conf)
(memo fn-or-var mount-conf cache-conf)
Combines cache create and bind operations from this namespace.
If conf is provided, it is used as mount-conf in bind operation, but with any extra map keys going into cache create configuration.
Combines cache create and bind operations from this namespace. If conf is provided, it is used as mount-conf in bind operation, but with any extra map keys going into cache create configuration.
(memo-add! f m)
Add map's entries to the cache. The keys are argument-lists.
Returns f.
Add map's entries to the cache. The keys are argument-lists. Returns f.
(memo-clear! f)
(memo-clear! f & fargs)
Invalidate one entry (f with arglist) on memoized function f, or invalidate all entries for memoized function. Returns f.
Invalidate one entry (f with arglist) on memoized function f, or invalidate all entries for memoized function. Returns f.
(memo-clear-cache! cache)
Invalidate all entries in Cache. Returns cache.
Invalidate all entries in Cache. Returns cache.
(memo-clear-tag! tag id)
Invalidate all entries that have the specified tag + id metadata. ID can be anything.
Invalidate all entries that have the specified tag + id metadata. ID can be anything.
(memo-unwrap f)
Takes a function and returns an uncached function.
Takes a function and returns an uncached function.
(memoized? f)
Returns true if function is memoized.
Returns true if function is memoized.
(mounts-by-tag tag)
Returns a sequence of MountPoint instances used by memoized functions which are tagged by this tag.
Returns a sequence of MountPoint instances used by memoized functions which are tagged by this tag.
(tags f)
Return tags of the memoized function.
Return tags of the memoized function.
(update-tag-caches! tag cache-fn)
For each memoized function with the specified tag, set the Cache used by the fn to (cache-fn current-cache).
Cache update function is ran on each memoized function (mount point), so if one cache is backing multiple functions, the cache update function is called multiple timed on it. If you want to run cache-fn one each Cache instance only once, I recommend wrapping it in clojure.core/memoize.
If caches are thread-bound to a different value with with-caches, then those bindings are modified instead of root bindings.
For each memoized function with the specified tag, set the Cache used by the fn to (cache-fn current-cache). Cache update function is ran on each memoized function (mount point), so if one cache is backing multiple functions, the cache update function is called multiple timed on it. If you want to run cache-fn one each Cache instance only once, I recommend wrapping it in clojure.core/memoize. If caches are thread-bound to a different value with with-caches, then those bindings are modified instead of root bindings.
(with-caches tag cache-fn & body)
Within the block, each memoized function with the specified tag has its cache update by cache-fn.
The values are bound within the block as a thread local binding. Cache update function is ran on each memoized function (mount point), so if one cache is backing multiple functions, the cache update function is called multiple timed on it. If you want to run cache-fn one each Cache instance only once, I recommend wrapping it in clojure.core/memoize.
Within the block, each memoized function with the specified tag has its cache update by cache-fn. The values are bound within the block as a thread local binding. Cache update function is ran on each memoized function (mount point), so if one cache is backing multiple functions, the cache update function is called multiple timed on it. If you want to run cache-fn one each Cache instance only once, I recommend wrapping it in clojure.core/memoize.
(with-tag-id v tag id)
Wrap a function result value in a wrapper that has the given additional tag + ID information. You can add multiple IDs for same tag.
This information is later used by memo-clear-tag!.
Wrap a function result value in a wrapper that has the given additional tag + ID information. You can add multiple IDs for same tag. This information is later used by memo-clear-tag!.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close