(cache-stats->map cs)
Convert CacheStats object readonly attributes to a clojure map see: https://www.javadoc.io/static/com.github.ben-manes.caffeine/caffeine/2.8.0/com/github/benmanes/caffeine/cache/stats/CacheStats.html for actual metrics docs.
Convert CacheStats object readonly attributes to a clojure map see: https://www.javadoc.io/static/com.github.ben-manes.caffeine/caffeine/2.8.0/com/github/benmanes/caffeine/cache/stats/CacheStats.html for actual metrics docs.
(make-builder settings)
A builder for the various types of Caffeine's caches (AsyncCache, AsyncLoadingCache, Cache, LoadingCache). The corresponding create
functions, accept and pass here this config to create the required cache.
settings
is a map with the keys (all optional):
:recordStats
boolean
:statsCounterSupplier
a com.github.benmanes.caffeine.cache.stats.StatsCounter
, mutually exclusive with :recordStats
:maximumSize
long
Specifies the maximum number of entries the cache may contain.:expireAfter
com.github.benmanes.caffeine.cache.Expiry
:expireAfterAccess
long
, references :timeUnit. Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, the most recent replacement of its value, or its last read.:expireAfterWrite
long
, references :timeUnit. Specifies that active entries are eligible for automatic refresh once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value.:executor
java.util.concurrent.Executor
Specifies the executor to use when running asynchronous tasks.:weakKeys
boolean
. Specifies that each key (not value) stored in the cache should be wrapped in a WeakReference (by default, strong references are used).:initialCapacity
'long'. Sets the minimum total size for the internal data structures.:softValues
Boolean
Specifies that each value (not key) stored in the cache should be wrapped in a SoftReference (by default, strong references are used). Softly-referenced objects will be garbage-collected in a globally least-recently-used manner, in response to memory demand.:ticker
com.github.benmanes.caffeine.cache.Ticker
Specifies a nanosecond-precision time source for use in determining when entries should be expired or refreshed. By default, System.nanoTime() is used.:removalListener
com.github.benmanes.caffeine.cache.RemovalListener
Specifies a listener instance that caches should notify each time an entry is removed for any reason. Each cache created by this builder will invoke this listener as part of the routine maintenance described in the class documentation above.:weigher
com.github.benmanes.caffeine.cache.Weigher
Specifies the weigher to use in determining the weight of entries.:writer
com.github.benmanes.caffeine.cache.CacheWriter
Specifies a writer instance that caches should notify each time an entry is explicitly created or modified, or removed for any reason.:timeUnit
[:ms :us :s :m :h :d]
default is :s
A builder for the various types of Caffeine's caches (AsyncCache, AsyncLoadingCache, Cache, LoadingCache). The corresponding `create` functions, accept and pass here this config to create the required cache. `settings` is a map with the keys (all optional): * `:recordStats` `boolean` * `:statsCounterSupplier` a `com.github.benmanes.caffeine.cache.stats.StatsCounter`, mutually exclusive with `:recordStats` * `:maximumSize` `long` Specifies the maximum number of entries the cache may contain. * `:expireAfter` `com.github.benmanes.caffeine.cache.Expiry` * `:expireAfterAccess` `long`, references :timeUnit. Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, the most recent replacement of its value, or its last read. * `:expireAfterWrite` `long`, references :timeUnit. Specifies that active entries are eligible for automatic refresh once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value. * `:executor` `java.util.concurrent.Executor` Specifies the executor to use when running asynchronous tasks. * `:weakKeys` `boolean`. Specifies that each key (not value) stored in the cache should be wrapped in a WeakReference (by default, strong references are used). * `:initialCapacity` 'long'. Sets the minimum total size for the internal data structures. * `:softValues` `Boolean` Specifies that each value (not key) stored in the cache should be wrapped in a SoftReference (by default, strong references are used). Softly-referenced objects will be garbage-collected in a globally least-recently-used manner, in response to memory demand. * `:ticker` `com.github.benmanes.caffeine.cache.Ticker` Specifies a nanosecond-precision time source for use in determining when entries should be expired or refreshed. By default, System.nanoTime() is used. * `:removalListener` `com.github.benmanes.caffeine.cache.RemovalListener` Specifies a listener instance that caches should notify each time an entry is removed for any reason. Each cache created by this builder will invoke this listener as part of the routine maintenance described in the class documentation above. * `:weigher` `com.github.benmanes.caffeine.cache.Weigher` Specifies the weigher to use in determining the weight of entries. * `:writer` `com.github.benmanes.caffeine.cache.CacheWriter` Specifies a writer instance that caches should notify each time an entry is explicitly created or modified, or removed for any reason. * `:timeUnit` ``[:ms :us :s :m :h :d]`` default is `:s`
(reify-async-cache-loader loading-fn)
(reify-async-cache-loader loading-fn reloading-fn)
A helper for implemeting an AsyncCacheLoader
.
loading-fn
(fn [this k executor])
. Asynchronously computes or retrieves the value corresponding to key.reloading-fn
(optional) (fn [this k old-val executor])
Asynchronously computes or retrieves a replacement value corresponding to an already-cached key. If the replacement value is not found then the mapping will be removed if null is computed. This method is called when an existing cache entry is refreshed by Caffeine.refreshAfterWrite(java.time.Duration), or through a call to LoadingCache.refresh(K).A helper for implemeting an `AsyncCacheLoader`. * `loading-fn` ``(fn [this k executor])``. Asynchronously computes or retrieves the value corresponding to key. * `reloading-fn` (optional) ``(fn [this k old-val executor])`` Asynchronously computes or retrieves a replacement value corresponding to an already-cached key. If the replacement value is not found then the mapping will be removed if null is computed. This method is called when an existing cache entry is refreshed by Caffeine.refreshAfterWrite(java.time.Duration), or through a call to LoadingCache.refresh(K).
(reify-cache-loader loading-fn)
(reify-cache-loader loading-fn reloading-fn)
A helper for implemeting CacheLoader
loading-fn
(fn [this k])` Computes or retrieves the value corresponding to key.relaoding-fn
`(fn [this k old-val]) Computes or retrieves a replacement value corresponding to an already-cached key.A helper for implemeting `CacheLoader` * `loading-fn `(fn [this k])` Computes or retrieves the value corresponding to key. * `relaoding-fn` `(fn [this k old-val]) Computes or retrieves a replacement value corresponding to an already-cached key.
(reify-cache-writer delete-handler write-handler)
A helper for implementingCacheWriter
delete-handler
(fn [this k v removal-cause])
Deletes the value corresponding to the key from the external resource.write-handler
(fn [this k v])
Writes the value corresponding to the key to the external resource.A helper for implementing` CacheWriter` * `delete-handler` `(fn [this k v removal-cause])` Deletes the value corresponding to the key from the external resource. * `write-handler` `(fn [this k v])` Writes the value corresponding to the key to the external resource.
(reify-weigher weigh-fn)
A helper for implemeting Weigher
weigh-fn
(fn [this k v])
Returns the weight of a cache entry (int). There is no unit for entry weights; rather they are simply relative to each other.
A helper for implemeting `Weigher` `weigh-fn` `(fn [this k v])` Returns the weight of a cache entry (int). There is no unit for entry weights; rather they are simply relative to each other.
(stats c)
Returns a current snapshot of this cache's cumulative statistics.
Returns a current snapshot of this cache's cumulative statistics.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close