defmemo now defines the var with the memoized function in a single def, instead of
defining the plain function and then rebinding the var root with alter-var-root.
The ::m/cache/::m/mount config forms are evaluated once and the evaluated values
are stored in var meta. All other defn metadata (docstring, arglists, type hints) is kept.defmemo throws at macro expansion time on primitive (long/double) type hints,
because memoized functions cannot implement the primitive invoke interfaces.start-secondary-invalidation! and finalize-invalidation! lifecycle;
mount tags are no longer required.memento.core/start-invalidation! and memento.core/with-invalidation for keeping
cache loads out of the interval around an underlying write. Concurrent callers block until
the lockout ends, with a one-minute diagnostic timeout for leaked or self-owned lockouts.with-sec-id and memo-clear-sec-id!.mc/lite, a Caffeine cache without secondary-index support.with-tag-id, memo-clear-tag!, and
memo-clear-tags!; use secondary IDs instead.ret-ex-fn transformations are now also delivered to the caller that performs
the load, matching the exception seen by concurrent callers.invalidateIds from
ICache and removed memento.base/invalidate-ids.memento.guava, memento.guava.config,
mc/guava, and the no-op mc/concurrency setting.if-cached no longer rethrows exceptions from a failed in-flight load on the
same key; it returns absent (cache miss) instead. Callers probing for a cached
value will no longer surface unrelated loader errors.invalidateId is now invalidateIds and takes an iterable of tag ids; implementations are expected to coordinate in-flight loads with tag invalidations.memento.multi namespaceHere is an example of previous callstack of recursively cached call (without ret-fn):
at myns$myfn.invoke(myns.clj:12)
at clojure.lang.AFn.applyToHelper(AFn.java:160)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$apply.invoke(core.clj:662)
at memento.caffeine.CaffeineCache$fn__2536.invoke(caffeine.clj:122)
at memento.caffeine.CaffeineCache.cached(caffeine.clj:121)
at memento.mount.UntaggedMountPoint.cached(mount.clj:50)
at memento.mount$bind$fn__2432.doInvoke(mount.clj:119)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.AFunction$1.doInvoke(AFunction.java:31)
at clojure.lang.RestFn.invoke(RestFn.java:436)
at myns$myfn.invokeStatic(myns.clj:17)
at myns$myfn.invoke(myns.clj:12)
And callstack after:
at myns$myfn.invoke(myns.clj:12)
at clojure.lang.AFn.applyToHelper(AFn.java:160)
at memento.caffeine.CaffeineCache$fn__2052.invoke(caffeine.clj:120)
at memento.caffeine.CaffeineCache.cached(caffeine.clj:119)
at memento.mount.CachedFn.invoke(CachedFn.java:110)
at myns$myfn.invokeStatic(myns.clj:17)
at myns$myfn.invoke(myns.clj:12)
From 11 stack frames to 4.
memento.core/defmemomemento.core/key-fn* mount settingmemento.core/if-configCan you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |