This is the function-cache Reference Manual, version 1.0.3, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 05:13:41 2024 GMT+0.
function-cache/function-cache.asd
function-cache/src/packages.lisp
function-cache/src/protocol.lisp
function-cache/src/capacity.lisp
function-cache/src/metering.lisp
function-cache/src/function-cache.lisp
function-cache/src/thunk.lisp
function-cache/src/single-cell.lisp
function-cache/src/hash-table.lisp
function-cache/src/ordered.lisp
function-cache/src/cache.lisp
The main system appears first, followed by any subsystem dependency.
function-cache
A Simple Caching Layer for functions
Acceleration.net <programmers@acceleration.net>
BSD
1.0.3
alexandria
(system).
cl-interpol
(system).
iterate
(system).
symbol-munger
(system).
closer-mop
(system).
src
(module).
Modules are listed depth-first from the system components tree.
function-cache/src
function-cache
(system).
packages.lisp
(file).
protocol.lisp
(file).
capacity.lisp
(file).
metering.lisp
(file).
function-cache.lisp
(file).
thunk.lisp
(file).
single-cell.lisp
(file).
hash-table.lisp
(file).
ordered.lisp
(file).
cache.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
function-cache/function-cache.asd
function-cache/src/packages.lisp
function-cache/src/protocol.lisp
function-cache/src/capacity.lisp
function-cache/src/metering.lisp
function-cache/src/function-cache.lisp
function-cache/src/thunk.lisp
function-cache/src/single-cell.lisp
function-cache/src/hash-table.lisp
function-cache/src/ordered.lisp
function-cache/src/cache.lisp
function-cache/function-cache.asd
function-cache
(system).
function-cache/src/protocol.lisp
packages.lisp
(file).
src
(module).
at-cache-capacity?
(generic function).
cached-results-count
(generic function).
clear-cache
(generic function).
defcached-hashkey
(generic function).
get-cached-value
(generic function).
(setf get-cached-value)
(generic function).
purge-cache
(generic function).
reduce-cached-set
(generic function).
*cache*
(special variable).
*cached-at*
(special variable).
cache
(reader method).
(setf cache)
(writer method).
cache-value-condition
(condition).
cached-a-value
(condition).
cached-at
(reader method).
(setf cached-at)
(writer method).
expired-a-value
(condition).
expired?
(generic function).
key
(reader method).
(setf key)
(writer method).
key-cached?
(generic function).
make-cache-backing
(generic function).
removed-a-value
(condition).
removed-at
(reader method).
(setf removed-at)
(writer method).
value
(reader method).
(setf value)
(writer method).
function-cache/src/capacity.lisp
protocol.lisp
(file).
src
(module).
at-cache-capacity?
(method).
cache-capacity-mixin
(class).
capacity
(reader method).
(setf capacity)
(writer method).
(setf get-cached-value)
(method).
reduce-by-ratio
(reader method).
(setf reduce-by-ratio)
(writer method).
number-to-remove
(function).
function-cache/src/metering.lisp
capacity.lisp
(file).
src
(module).
accesses
(function).
get-cached-value
(method).
hit-ratio
(function).
hits
(reader method).
(setf hits)
(writer method).
metered-mixin
(class).
misses
(reader method).
(setf misses)
(writer method).
reset-counters
(generic function).
get-cached-object-stats
(function).
incf-hash
(function).
function-cache/src/function-cache.lisp
metering.lisp
(file).
src
(module).
*bypass-cache*
(special variable).
cached-results
(reader method).
cached-results
(method).
(setf cached-results)
(writer method).
clear-cache
(method).
compute-cache-key
(generic function).
initialize-instance
(method).
print-object
(method).
purge-cache
(method).
timeout
(reader method).
(setf timeout)
(writer method).
%insert-into-cache
(function).
body-fn
(reader method).
(setf body-fn)
(writer method).
cacher
(generic function).
function-cache
(class).
lambda-list
(reader method).
(setf lambda-list)
(writer method).
name
(reader method).
(setf name)
(writer method).
shared-results?
(reader method).
(setf shared-results?)
(writer method).
function-cache/src/thunk.lisp
function-cache.lisp
(file).
src
(module).
cached-results-count
(method).
get-cached-value
(method).
(setf get-cached-value)
(method).
purge-cache
(method).
thunk-cache
(class).
key-cached?
(method).
function-cache/src/single-cell.lisp
thunk.lisp
(file).
src
(module).
cached-results-count
(method).
get-cached-value
(method).
(setf get-cached-value)
(method).
purge-cache
(method).
single-cell-function-cache
(class).
key-cached?
(method).
make-cache-backing
(method).
test
(reader method).
(setf test)
(writer method).
function-cache/src/hash-table.lisp
single-cell.lisp
(file).
src
(module).
cached-results-count
(method).
clear-cache
(method).
clear-cache-partial-arguments
(generic function).
get-cached-value
(method).
(setf get-cached-value)
(method).
hash-table-function-cache
(class).
hash-table-function-cache-with-capacity
(class).
partial-argument-match?
(generic function).
purge-cache
(method).
reduce-cached-set
(method).
*default-hash-init-args*
(special variable).
hash-init-args
(reader method).
(setf hash-init-args)
(writer method).
key-cached?
(method).
make-cache-backing
(method).
metered-hash-table-cache
(class).
function-cache/src/ordered.lisp
hash-table.lisp
(file).
src
(module).
clear-cache
(method).
clear-cache-partial-arguments
(method).
get-cached-value
(method).
(setf get-cached-value)
(method).
lru-cache
(class).
mru-cache
(class).
purge-cache
(method).
reduce-cached-set
(method).
reduce-cached-set
(method).
%add-cached-node
(function).
%move-cached-node
(function).
%remove-cached-node
(function).
cache-node
(type).
cnode
(function).
cnode
(structure).
cnode-cache-key
(reader).
(setf cnode-cache-key)
(writer).
cnode-newer
(reader).
(setf cnode-newer)
(writer).
cnode-older
(reader).
(setf cnode-older)
(writer).
cnode-p
(function).
cnode-result
(reader).
(setf cnode-result)
(writer).
copy-cnode
(function).
newest-node
(reader method).
(setf newest-node)
(writer method).
oldest-node
(reader method).
(setf oldest-node)
(writer method).
ordered-cache-mixin
(class).
sync-ordered-cache
(function).
function-cache/src/cache.lisp
ordered.lisp
(file).
src
(module).
*cache-names*
(special variable).
*default-cache-class*
(special variable).
clear-all-caches
(function).
clear-cache
(method).
clear-cache
(method).
clear-cache-all-function-caches
(function).
defcached
(macro).
find-function-cache-for-name
(function).
purge-all-caches
(function).
purge-cache
(method).
%call-list-for-lambda-list
(function).
%ensure-unquoted
(function).
default-cache-class
(generic function).
do-caches
(function).
Packages are listed by definition order.
function-cache
A simple caching layer for functions
common-lisp
.
iterate
.
*bypass-cache*
(special variable).
*cache-names*
(special variable).
*default-cache-class*
(special variable).
accesses
(function).
at-cache-capacity?
(generic function).
cache-capacity-mixin
(class).
cached-results
(generic function).
(setf cached-results)
(generic writer).
cached-results-count
(generic function).
capacity
(generic reader).
(setf capacity)
(generic writer).
clear-all-caches
(function).
clear-cache
(generic function).
clear-cache-all-function-caches
(function).
clear-cache-partial-arguments
(generic function).
compute-cache-key
(generic function).
defcached
(macro).
defcached-hashkey
(generic function).
find-function-cache-for-name
(function).
get-cached-value
(generic function).
(setf get-cached-value)
(generic function).
hash-table-function-cache
(class).
hash-table-function-cache-with-capacity
(class).
hit-ratio
(function).
hits
(generic reader).
(setf hits)
(generic writer).
lru-cache
(class).
metered-mixin
(class).
misses
(generic reader).
(setf misses)
(generic writer).
mru-cache
(class).
partial-argument-match?
(generic function).
purge-all-caches
(function).
purge-cache
(generic function).
reduce-by-ratio
(generic reader).
(setf reduce-by-ratio)
(generic writer).
reduce-cached-set
(generic function).
reset-counters
(generic function).
single-cell-function-cache
(class).
thunk-cache
(class).
timeout
(generic reader).
(setf timeout)
(generic writer).
%add-cached-node
(function).
%call-list-for-lambda-list
(function).
%ensure-unquoted
(function).
%insert-into-cache
(function).
%move-cached-node
(function).
%remove-cached-node
(function).
*cache*
(special variable).
*cached-at*
(special variable).
*default-hash-init-args*
(special variable).
body-fn
(generic reader).
(setf body-fn)
(generic writer).
cache
(generic reader).
(setf cache)
(generic writer).
cache-node
(type).
cache-value-condition
(condition).
cached-a-value
(condition).
cached-at
(generic reader).
(setf cached-at)
(generic writer).
cacher
(generic function).
cnode
(function).
cnode
(structure).
cnode-cache-key
(reader).
(setf cnode-cache-key)
(writer).
cnode-newer
(reader).
(setf cnode-newer)
(writer).
cnode-older
(reader).
(setf cnode-older)
(writer).
cnode-p
(function).
cnode-result
(reader).
(setf cnode-result)
(writer).
copy-cnode
(function).
default-cache-class
(generic function).
do-caches
(function).
expired-a-value
(condition).
expired?
(generic function).
function-cache
(class).
get-cached-object-stats
(function).
hash-init-args
(generic reader).
(setf hash-init-args)
(generic writer).
incf-hash
(function).
key
(generic reader).
(setf key)
(generic writer).
key-cached?
(generic function).
lambda-list
(generic reader).
(setf lambda-list)
(generic writer).
make-cache-backing
(generic function).
metered-hash-table-cache
(class).
name
(generic reader).
(setf name)
(generic writer).
newest-node
(generic reader).
(setf newest-node)
(generic writer).
number-to-remove
(function).
oldest-node
(generic reader).
(setf oldest-node)
(generic writer).
ordered-cache-mixin
(class).
removed-a-value
(condition).
removed-at
(generic reader).
(setf removed-at)
(generic writer).
shared-results?
(generic reader).
(setf shared-results?)
(generic writer).
sync-ordered-cache
(function).
test
(generic reader).
(setf test)
(generic writer).
value
(generic reader).
(setf value)
(generic writer).
Definitions are sorted by export status, category, package, and then by lexicographic order.
if non-nil, skip any kind of caching
A list of all function-caches
cache class to use if unspecified and thunk is not applicable
Creates a cached function named SYMBOL and a cache object named *{FN-NAME}-CACHE*
SYMBOL can also be a list (FN-NAME &rest CACHE-INIT-ARGS
&key CACHE-CLASS TABLE TIMEOUT SHARED-RESULTS?)
TABLE - a shared cache-store to use, usually a hash-table, a function that returns
a hashtable, or a symbol whose value is a hash-table
TIMEOUT - how long entries in the cache should be considered valid for
CACHE-CLASS - controls what cache class will be instantiated (uses
default-cache-class if not provided)
SHARED-RESULTS? - do we expect that we are sharing cache space with other things
defaults to t if TABLE is provided
CACHE-INIT-ARGS - any other args that should be passed to the cache
how many total accesses this cache has seen
Clear all the packages we know about. If there is a package mentioned, clear only those caches whose names are in that package
given a name get the cache object associated with it
Call purge on all matching cache objects. If package is provided, purge only caches located within that package
is the cache full?
cache-capacity-mixin
)) ¶function-cache
)) ¶Coerce the refernce to the results into something we can use
function-cache
)) ¶automatically generated reader method
function-cache
)) ¶automatically generated writer method
A function to compute the number of results that have been cached. DOES NOT CHECK to see if the entries are expired
hash-table-function-cache
)) ¶single-cell-function-cache
)) ¶thunk-cache
)) ¶null
)) ¶list
)) ¶hash-table
)) ¶cache-capacity-mixin
)) ¶cache-capacity-mixin
)) ¶The maximum number of objects cached, when we hit this we will reduce the number of cached entries by reduce-by-ratio
Clears a given cache
symbol
) &optional args) ¶null
) &optional args) ¶ordered-cache-mixin
) &optional args) ¶hash-table-function-cache
) &optional args) ¶function-cache
) &optional args) ¶This function will go through the cached-results removing
keys that partially match the to-match list.
This is used to clear the cache of shared? caches, but is also useful in
other cases, where we need to clear cache for some subset of the
arguments (eg: a cached funcall might wish to clear the cache of a
specific funcalled function).
Matches arguments for those provided. Anything not provided is considered
function-cache:dont-care. Anything specified as function-cache:dont-care
is not used to determine if there is a match
ordered-cache-mixin
) to-match) ¶hash-table-function-cache
) to-match) ¶Used to assemble cache keys for function-cache objects
function-cache
) thing) ¶Turns a list of arguments into a valid cache-key (usually a tree of primatives)
returns the result-values-list and at what time it was cached
ordered-cache-mixin
) cache-key) ¶hash-table-function-cache
) cache-key) ¶single-cell-function-cache
) cache-key) ¶thunk-cache
) cache-key) ¶metered-mixin
) cache-key) ¶Set the cached value for the cache key
ordered-cache-mixin
) cache-key) ¶hash-table-function-cache
) cache-key) ¶single-cell-function-cache
) cache-key) ¶thunk-cache
) cache-key) ¶cache-capacity-mixin
) cache-key) ¶metered-mixin
)) ¶metered-mixin
)) ¶how many cache hits
hits
.
metered-mixin
)) ¶metered-mixin
)) ¶how many cache hits
Trys to see if the cache-key matches the to-match partial
key passed in.
The basic implementation is to go through the cache-keys and match in order, skipping to-match component that is function-cache:dont-care
hash-table-function-cache
) cached-key to-match &key test) ¶A function that will remove expired entries from the cache, allowing them to be garbage collected
symbol
)) ¶ordered-cache-mixin
)) ¶hash-table-function-cache
)) ¶single-cell-function-cache
)) ¶thunk-cache
)) ¶function-cache
)) ¶cache-capacity-mixin
)) ¶cache-capacity-mixin
)) ¶Remove the oldest reduce-by-ratio entries (eg: .2 or 20%)
evict n items from the cache
When we clear the full cache, reset the counters
symbol
)) ¶metered-mixin
)) ¶function-cache
)) ¶automatically generated reader method
function-cache
)) ¶automatically generated writer method
function-cache
) &key &allow-other-keys) ¶function-cache
) s) ¶The maximum number of objects cached, when we hit this we will reduce the number of cached entries by reduce-by-ratio
:capacity
Remove the oldest reduce-by-ratio entries (eg: .2 or 20%)
0.2
:reduce-by-ratio
a function cache that uses a hash-table to store results
function-cache::*default-hash-init-args*
:hash-init-args
a function cache that uses a hash-table to store results with a max capacity
LRU cache backed by a hash-table.
Maintains capacity by removing least recently used cached values.
adds some recording for caches hits/misses
MRU cache backed by a hash-table.
Maintains capacity by removing the most recently used cached value.s
a cache that stores only the most recent result of running the body
a cache optimized for functions of no arguments (uses a cons for caching)
Add a node to the last position of the cache.
Turns a lambda list into a list that can be applied to functions of that lambda list
Simple helper to run the body, store the results in the cache and then return them
Move a node to the end of the cache, should be called when a cached result has been used.
Remove a node from the cache.
Iterate through caches calling fn on each matching cache
Remove any nodes from the dlist that are no longer in the actual cache.
function-cache
)) ¶automatically generated reader method
function-cache
)) ¶automatically generated writer method
cache-value-condition
)) ¶cache-value-condition
)) ¶cache-value-condition
)) ¶cache-value-condition
)) ¶A function that takes a cache object and an arg list
and either runs the computation and fills the caches or retrieves
the cached value
function-cache
) args) ¶A function that takes symbol lambda-list and perhaps a cache-class
Determines if the cache entry is expired
hash-table-function-cache
)) ¶automatically generated reader method
hash-table-function-cache
)) ¶automatically generated writer method
cache-value-condition
)) ¶cache-value-condition
)) ¶key
.
Check if the cache contains a cached value for the key.
This should not have any side affects, even if GET-CACHED-VALUE does (for instance in an LRU cache).
Return non-nil if the cache contains an entry with the specified key.
Note that this returns non-nil if the key is cached but expired.
hash-table-function-cache
) cache-key) ¶single-cell-function-cache
) cache-key) ¶thunk-cache
) cache-key) ¶function-cache
)) ¶automatically generated reader method
function-cache
)) ¶automatically generated writer method
make a new backing storage for the cache
hash-table-function-cache
)) ¶single-cell-function-cache
)) ¶function-cache
)) ¶automatically generated reader method
name
.
function-cache
)) ¶automatically generated writer method
name
.
ordered-cache-mixin
)) ¶automatically generated reader method
ordered-cache-mixin
)) ¶automatically generated writer method
ordered-cache-mixin
)) ¶automatically generated reader method
ordered-cache-mixin
)) ¶automatically generated writer method
removed-a-value
)) ¶removed-a-value
)) ¶single-cell-function-cache
)) ¶automatically generated reader method
test
.
single-cell-function-cache
)) ¶automatically generated writer method
test
.
cache-value-condition
)) ¶cache-value-condition
)) ¶condition
.
(quote nil)
:cache
(quote nil)
:value
(quote nil)
:cached-at
(quote (get-universal-time))
:removed-at
an object that contains the cached results of function calls
the original function to be run, to set cached values
and other cache configuration parameters. This class is mostly intended
to be abstract with hash-table-function-cache, and thunk-cache being the
current concrete classes
:cached-results
:timeout
:body-fn
:lambda-list
cache backed by a hash-table, keeps metrics
Mixin that keeps track of the order of cached results in a doubly linked list. FIRST references the oldest cached result, and LAST references the most recent.
Jump to: | %
(
A B C D E F G H I K L M N O P R S T V |
---|
Jump to: | %
(
A B C D E F G H I K L M N O P R S T V |
---|
Jump to: | *
B C H K L M N O R S T V |
---|
Jump to: | *
B C H K L M N O R S T V |
---|
Jump to: | C E F H L M O P R S T |
---|
Jump to: | C E F H L M O P R S T |
---|