Infinispan-backed implementations of core.cache and core.memoize
protocols supporting multiple replication options and more.
->DelayedCache
function
Usage: (->DelayedCache cache delayed)
Positional factory function for class immutant.cache.DelayedCache.
Source
->InfinispanCache
function
Usage: (->InfinispanCache cache options)
Positional factory function for class immutant.cache.InfinispanCache.
Source
Mutable
var
Functions for manipulating a shared, distributed cache.
Every 'put' function optionally accepts a map with the following
lifespan-oriented keys:
:ttl - time-to-live, the max time the entry will live before expiry [-1]
:idle - the time after which an entry will expire if not accessed [-1]
:units - the units for the values of :ttl and :idle [:seconds]
Negative values imply no expiration.
Possible values for :units -- :days, :hours, :minutes, :seconds,
:milliseconds, :microseconds :nanoseconds
The conditional functions, e.g. put-if-*, are all atomic.
Source
cache
function
Usage: (cache name & {:keys [mode seed], :as options})
Returns an object that implements both Mutable and
core.cache/CacheProtocol. A name is the only required argument. The
following options are supported:
The following options are supported [default]:
:mode Replication mode [:invalidated or :local]
:local, :invalidated, :distributed, or :replicated
:seed A hash of initial entries [nil]
:ttl The max time the entry will live before expiry [-1]
:idle The time after which an entry will expire if not accessed [-1]
:units The units for the values of :ttl and :idle [:seconds]
The replication mode defaults to :invalidated when clustered. When
not clustered, the value of :mode is ignored, and the cache will
be :local.
Seeding the cache will delete any existing entries.
The lifespan-oriented options (:ttl :idle :units) become the
default options for the functions of the Mutable protocol. But any
options passed to those functions take precedence over these.
Source
delete
function
Usage: (delete cache key)
(delete cache key value)
Delete the entry; value must match current if passed
delete-all
function
Usage: (delete-all cache)
Clear all entries from the cache and return it
memo
function
Usage: (memo f name & options)
Memoize a function by associating its arguments with return values
stored in a possibly-clustered Infinispan-backed cache. Other than
the function to be memoized, arguments are the same as for the
cache function.
Source
put
function
Usage: (put cache key value)
(put cache key value options)
Put an entry in the cache
put-all
function
Usage: (put-all cache map)
(put-all cache map options)
Put all the entries in cache
put-if-absent
function
Usage: (put-if-absent cache key value)
(put-if-absent cache key value options)
Put it in only if key is not already there
put-if-present
function
Usage: (put-if-present cache key value)
(put-if-present cache key value options)
Put it in only if key is already there
put-if-replace
function
Usage: (put-if-replace cache key old new)
(put-if-replace cache key old new options)
Put it in only if key is there and current matches old
clustered-cache
function
Usage: (clustered-cache name & {:keys [mode sync], :or {sync true}})
Defaults to :distributed, with :sync=true
Source
raw-cache
function
Usage: (raw-cache name)
(raw-cache name mode)
Returns the raw Infinispan cache, clustered if possible, otherwise local
Source