Liking cljdoc? Tell your friends :D

memento.core

Memoization library.

Memoization library.
raw docstring

active-cacheclj

(active-cache f)

Return Cache instance from the function, if present.

Return Cache instance from the function, if present.
sourceraw docstring

as-mapclj

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

bindclj

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

  • memento.core/key-fn
  • memento.core/ret-fn
  • memento.core/tags
  • memento.core/seed
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
sourceraw docstring

createclj

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

do-not-cacheclj

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

memoclj

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

memo-add!clj

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

memo-clear!clj

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

memo-clear-cache!clj

(memo-clear-cache! cache)

Invalidate all entries in Cache. Returns cache.

Invalidate all entries in Cache. Returns cache.
sourceraw docstring

memo-clear-tag!clj

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

memo-unwrapclj

(memo-unwrap f)

Takes a function and returns an uncached function.

Takes a function and returns an uncached function.
sourceraw docstring

memoized?clj

(memoized? f)

Returns true if function is memoized.

Returns true if function is memoized.
sourceraw docstring

mounts-by-tagclj

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

tagsclj

(tags f)

Return tags of the memoized function.

Return tags of the memoized function.
sourceraw docstring

update-tag-caches!clj

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

with-cachescljmacro

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

with-tag-idclj

(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!.
sourceraw docstring

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

× close