A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://clojure.github.io/core.cache/index.html below:

clojure.core.cache - core.cache 1.0.226-SNAPSHOT API documentation

API for clojure.core.cache -

Full namespace name:

clojure.core.cache Overview
A caching library for Clojure.

Protocols
CacheProtocolProtocol
This is the protocol describing the basic cache capability.

Known implementations:

BasicCache, FIFOCache, FnCache, LIRSCache, LRUCache, LUCache, SoftCache, TTLCacheQ
evictfunction
Usage: (evict cache e)
Removes an entry from the cache


has?function
Usage: (has? cache e)
Checks if the cache contains a value associated with `e`


hitfunction
Usage: (hit cache e)
Is meant to be called if the cache is determined to contain a value
associated with `e`


lookupfunction
Usage: (lookup cache e)
       (lookup cache e not-found)
Retrieve the value associated with `e` if it exists, else `nil` in
the 2-arg case.  Retrieve the value associated with `e` if it exists,
else `not-found` in the 3-arg case.


missfunction
Usage: (miss cache e ret)
Is meant to be called if the cache is determined to **not** contain a
value associated with `e`


seedfunction
Usage: (seed cache base)
Is used to signal that the cache should be created with a seed.
The contract is that said cache should return an instance of its
own type.
Source Types 

BasicCachetype

Fields:

[cache]

Protocols:

CacheProtocol

Interfaces:

clojure.lang.Associative, clojure.lang.Counted, clojure.lang.ILookup, clojure.lang.IPersistentCollection, clojure.lang.IPersistentMap, clojure.lang.Seqable, java.lang.Iterable

FIFOCachetype

Fields:

[cache q limit]

Protocols:

CacheProtocol

Interfaces:

clojure.lang.Associative, clojure.lang.Counted, clojure.lang.ILookup, clojure.lang.IPersistentCollection, clojure.lang.IPersistentMap, clojure.lang.Seqable, java.lang.Iterable

FnCachetype

Fields:

[cache f]

Protocols:

CacheProtocol

Interfaces:

clojure.lang.Associative, clojure.lang.Counted, clojure.lang.ILookup, clojure.lang.IPersistentCollection, clojure.lang.IPersistentMap, clojure.lang.Seqable, java.lang.Iterable

LIRSCachetype

Fields:

[cache lruS lruQ tick limitS limitQ]

Protocols:

CacheProtocol

Interfaces:

clojure.lang.Associative, clojure.lang.Counted, clojure.lang.ILookup, clojure.lang.IPersistentCollection, clojure.lang.IPersistentMap, clojure.lang.Seqable, java.lang.Iterable

LRUCachetype

Fields:

[cache lru tick limit]

Protocols:

CacheProtocol

Interfaces:

clojure.lang.Associative, clojure.lang.Counted, clojure.lang.ILookup, clojure.lang.IPersistentCollection, clojure.lang.IPersistentMap, clojure.lang.Seqable, java.lang.Iterable

LUCachetype

Fields:

[cache lu limit]

Protocols:

CacheProtocol

Interfaces:

clojure.lang.Associative, clojure.lang.Counted, clojure.lang.ILookup, clojure.lang.IPersistentCollection, clojure.lang.IPersistentMap, clojure.lang.Seqable, java.lang.Iterable

SoftCachetype

Fields:

[cache rcache rq]

Protocols:

CacheProtocol

Interfaces:

clojure.lang.Associative, clojure.lang.Counted, clojure.lang.ILookup, clojure.lang.IPersistentCollection, clojure.lang.IPersistentMap, clojure.lang.Seqable, java.lang.Iterable

TTLCacheQtype

Fields:

[cache ttl q gen ttl-ms]

Protocols:

CacheProtocol

Interfaces:

clojure.lang.Associative, clojure.lang.Counted, clojure.lang.ILookup, clojure.lang.IPersistentCollection, clojure.lang.IPersistentMap, clojure.lang.Seqable, java.lang.Iterable
Public Variables and Functions
->BasicCachefunction
Usage: (->BasicCache cache)
Positional factory function for class clojure.core.cache.BasicCache.
Source

->FIFOCachefunction
Usage: (->FIFOCache cache q limit)
Positional factory function for class clojure.core.cache.FIFOCache.
Source

->FnCachefunction
Usage: (->FnCache cache f)
Positional factory function for class clojure.core.cache.FnCache.
Source

->LIRSCachefunction
Usage: (->LIRSCache cache lruS lruQ tick limitS limitQ)
Positional factory function for class clojure.core.cache.LIRSCache.
Source

->LRUCachefunction
Usage: (->LRUCache cache lru tick limit)
Positional factory function for class clojure.core.cache.LRUCache.
Source

->LUCachefunction
Usage: (->LUCache cache lu limit)
Positional factory function for class clojure.core.cache.LUCache.
Source

->SoftCachefunction
Usage: (->SoftCache cache rcache rq)
Positional factory function for class clojure.core.cache.SoftCache.
Source

->TTLCacheQfunction
Usage: (->TTLCacheQ cache ttl q gen ttl-ms)
Positional factory function for class clojure.core.cache.TTLCacheQ.
Source

basic-cache-factoryfunction
Usage: (basic-cache-factory base)
Returns a pluggable basic cache initialized to `base`
Source

fifo-cache-factoryfunction
Usage: (fifo-cache-factory base & {threshold :threshold, :or {threshold 32}})
Returns a FIFO cache with the cache and FIFO queue initialized to `base` --
the queue is filled as the values are pulled out of `base`.  If the associative
structure can guarantee ordering, then the said ordering will define the
eventual eviction order.  Otherwise, there are no guarantees for the eventual
eviction ordering.

This function takes an optional `:threshold` argument that defines the maximum number
of elements in the cache before the FIFO semantics apply (default is 32).

If the number of elements in `base` is greater than the limit then some items
in `base` will be dropped from the resulting cache.  If the associative
structure used as `base` can guarantee sorting, then the last `limit` elements
will be used as the cache seed values.  Otherwise, there are no guarantees about
the elements in the resulting cache.
Source

lirs-cache-factoryfunction
Usage: (lirs-cache-factory base & {:keys [s-history-limit q-history-limit], :or {s-history-limit 32, q-history-limit 32}})
Returns an LIRS cache with the S & R LRU lists set to the indicated
limits.
Source

lru-cache-factoryfunction
Usage: (lru-cache-factory base & {threshold :threshold, :or {threshold 32}})
Returns an LRU cache with the cache and usage-table initialized to `base` --
each entry is initialized with the same usage value.

This function takes an optional `:threshold` argument that defines the maximum number
of elements in the cache before the LRU semantics apply (default is 32).
Source

lu-cache-factoryfunction
Usage: (lu-cache-factory base & {threshold :threshold, :or {threshold 32}})
Returns an LU cache with the cache and usage-table initialized to `base`.

This function takes an optional `:threshold` argument that defines the maximum number
of elements in the cache before the LU semantics apply (default is 32).
Source

soft-cache-factoryfunction
Usage: (soft-cache-factory base)
Returns a SoftReference cache.  Cached values will be referred to with
SoftReferences, allowing the values to be garbage collected when there is
memory pressure on the JVM.

SoftCache is a mutable cache, since it is always based on a
ConcurrentHashMap.
Source

throughfunction
Usage: (through cache item)
       (through value-fn cache item)
       (through wrap-fn value-fn cache item)
The basic hit/miss logic for the cache system.  Expects a wrap function and
value function.  The wrap function takes the value function and the item in question
and is expected to run the value function with the item whenever a cache
miss occurs.  The intent is to hide any cache-specific cells from leaking
into the cache logic itelf.
Source

through-cachefunction
Usage: (through-cache cache item)
       (through-cache cache item value-fn)
       (through-cache cache item wrap-fn value-fn)
The basic hit/miss logic for the cache system.  Like through but always has
the cache argument in the first position for easier use with swap! etc.
Source

ttl-cache-factoryfunction
Usage: (ttl-cache-factory base & {ttl :ttl, :or {ttl 2000}})
Returns a TTL cache with the cache and expiration-table initialized to `base` --
each with the same time-to-live.

This function also allows an optional `:ttl` argument that defines the default
time in milliseconds that entries are allowed to reside in the cache.
Source

clojure.core.cache.wrapped
A higher level way to use clojure.core.cache that assumes the immutable
cache is wrapped in an atom.

The API is (almost) the same as clojure.core.cache -- including the factory
functions -- but instead of accepting immutable caches, the functions
here accept atoms containing those caches. The factory functions return
new atoms containing the newly created cache.

In addition, lookup-or-miss provides a safe, atomic way to retrieve a
value from a cache or compute it if it is missing, without risking a
cache stampede.

Public Variables and Functions
basic-cache-factoryfunction
Usage: (basic-cache-factory base)
Returns a pluggable basic cache initialized to `base`
Source

evictfunction
Usage: (evict cache-atom e)
Removes an entry from the cache.

Returns the updated cache from the atom.
Source

fifo-cache-factoryfunction
Usage: (fifo-cache-factory base & {threshold :threshold, :or {threshold 32}})
Returns a FIFO cache with the cache and FIFO queue initialized to `base` --
the queue is filled as the values are pulled out of `base`.  If the associative
structure can guarantee ordering, then the said ordering will define the
eventual eviction order.  Otherwise, there are no guarantees for the eventual
eviction ordering.

This function takes an optional `:threshold` argument that defines the maximum number
of elements in the cache before the FIFO semantics apply (default is 32).

If the number of elements in `base` is greater than the limit then some items
in `base` will be dropped from the resulting cache.  If the associative
structure used as `base` can guarantee sorting, then the last `limit` elements
will be used as the cache seed values.  Otherwise, there are no guarantees about
the elements in the resulting cache.
Source

has?function
Usage: (has? cache-atom e)
Checks if the cache contains a value associated with `e`.

Reads from the current version of the atom.
Source

hitfunction
Usage: (hit cache-atom e)
Is meant to be called if the cache is determined to contain a value
associated with `e`.

Returns the updated cache from the atom. Provided for completeness.
Source

lirs-cache-factoryfunction
Usage: (lirs-cache-factory base & {:keys [s-history-limit q-history-limit], :or {s-history-limit 32, q-history-limit 32}})
Returns an LIRS cache with the S & R LRU lists set to the indicated
limits.
Source

lookupfunction
Usage: (lookup cache-atom e)
       (lookup cache-atom e not-found)
Retrieve the value associated with `e` if it exists, else `nil` in
the 2-arg case.  Retrieve the value associated with `e` if it exists,
else `not-found` in the 3-arg case.

Reads from the current version of the atom.
Source

lookup-or-missfunction
Usage: (lookup-or-miss cache-atom e value-fn)
       (lookup-or-miss cache-atom e wrap-fn value-fn)
Retrieve the value associated with `e` if it exists, else compute the
value (using value-fn, and optionally wrap-fn), update the cache for `e`
and then perform the lookup again.

value-fn (and wrap-fn) will only be called (at most) once even in the
case of retries, so there is no risk of cache stampede.

Since lookup can cause invalidation in some caches (such as TTL), we
trap that case and retry (a maximum of ten times).
Source

lru-cache-factoryfunction
Usage: (lru-cache-factory base & {threshold :threshold, :or {threshold 32}})
Returns an LRU cache with the cache and usage-table initialized to `base` --
each entry is initialized with the same usage value.

This function takes an optional `:threshold` argument that defines the maximum number
of elements in the cache before the LRU semantics apply (default is 32).
Source

lu-cache-factoryfunction
Usage: (lu-cache-factory base & {threshold :threshold, :or {threshold 32}})
Returns an LU cache with the cache and usage-table initialized to `base`.

This function takes an optional `:threshold` argument that defines the maximum number
of elements in the cache before the LU semantics apply (default is 32).
Source

missfunction
Usage: (miss cache-atom e ret)
Is meant to be called if the cache is determined to **not** contain a
value associated with `e`.

Returns the updated cache from the atom. Provided for completeness.
Source

seedfunction
Usage: (seed cache-atom base)
Is used to signal that the cache should be created with a seed.
The contract is that said cache should return an instance of its
own type.

Returns the updated cache from the atom. Provided for completeness.
Source

soft-cache-factoryfunction
Usage: (soft-cache-factory base)
Returns a SoftReference cache.  Cached values will be referred to with
SoftReferences, allowing the values to be garbage collected when there is
memory pressure on the JVM.

SoftCache is a mutable cache, since it is always based on a
ConcurrentHashMap.
Source

throughfunction
Usage: (through cache-atom item)
       (through value-fn cache-atom item)
       (through wrap-fn value-fn cache-atom item)
The basic hit/miss logic for the cache system.  Expects a wrap function and
value function.  The wrap function takes the value function and the item in question
and is expected to run the value function with the item whenever a cache
miss occurs.  The intent is to hide any cache-specific cells from leaking
into the cache logic itelf.
Source

through-cachefunction
Usage: (through-cache cache-atom item)
       (through-cache cache-atom item value-fn)
       (through-cache cache-atom item wrap-fn value-fn)
The basic hit/miss logic for the cache system.  Like through but always has
the cache argument in the first position.
Source

ttl-cache-factoryfunction
Usage: (ttl-cache-factory base & {ttl :ttl, :or {ttl 2000}})
Returns a TTL cache with the cache and expiration-table initialized to `base` --
each with the same time-to-live.

This function also allows an optional `:ttl` argument that defines the default
time in milliseconds that entries are allowed to reside in the cache.
Source


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4