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.- Fix: an invalidation (by key or by tag) that arrives while a load for the
same key is in flight is now reliably observed. Concurrent callers waiting
on the in-flight load will re-load instead of receiving the stale value.
- More robust handling of tagged entries when tags are invalidated during a
load, including cleanup of secondary indexes.
- Clear internal cache invalidation interrupts before retrying Caffeine loads.
- added a check that will throw an error if encountering mc/cache key in wrong place, cache configuration
- upgrade from Caffeine 2 to Caffeine 3. Min Java changed from 8 to 11.
- remove unneeded operation when adding entries into the map
- when an tag is invalidated during load, the loading thread will be interrupted
- improved variable expiry
- added stronger prevention of the use of invalid entries
- added variable expiry option (see README)
- removed some reflection
- enabled weakValues as an option for caffeine cache
- removed weakKeys as it's not possible to use that option
- added ret-ex-fn option to transform exceptions being thrown by cache in the same way ret-fn works for values
- add predicate memento.core/none-cache? that checks if cache is of none type
- new function memento.core/caches-by-tag
- important improvement of atomicity for invalidations by tag or function
- important fix for thread synchronization when adding tagged entries
- important fix for secondary indexes clearing
- reduced memory use
- improving performance on evictions when an eviction listener isn't used
- BREAKING CHANGE FOR IMPLEMENTATIONS
invalidateId is now invalidateIds and takes an iterable of tag ids; implementations are expected to coordinate in-flight loads with tag invalidations.
- Improve handling of Vectors when adding entries
- fixes a bug with concurrent loads causing some of them to return nil as a result
- DO NOT USE
- add check for cyclical loads to caffeine cache, e.g. cached function calling itself with same parameters, this now throws StackOverflowError, which is the error you'd get in this situation with uncached function
- improved performance
- added option of using SoftReferences in caffeine cache
- fixed reload-guards? var not being redefinable
- add getters/setters to MultiCache for the delegate/upstream cache, also add clojure functions to access these properties to
memento.multi namespace - moved CacheKey to memento.base Java package
- fix bug which would have the cache return nil when concurrently accessing a value being calculated that ends being uncacheable
- big internal changes now uses Java objects for most things for smaller memory profile and smaller callstack
- significant improvements to callstack size for cached call
- This is breaking changes for any implementation, shouldn't affect users
- Fixes issue where namespace scan would stack caches on the same function over and over if called multiple times
Here 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.
- remove Guava and replace with Caffeine
- rewrite the readme
- mark Guava namespaces for deprecation
- add
memento.core/key-fn* mount setting
- add support for using meta