Server caching facilities
== Description ==
These functions handle HOP server //caches//.
== Synopsis ==
(class cache ...)
(class cache-disk ...)
(class cache-memory ...)
(class cache-entry ...)
(registered-caches)
(unregister-cache! cache)
(cache-clear cache)
(cache->list cache)
(cache-get cache key)
(cache-put! cache key value)
== Examples ==
cache-get, cache-put!
== Server Definitions ==
=== ++(class cache ...)++ ===
cache
^ fields ^ type ^ default value ^ short description ^
| max-entries | integer | 128 | maximum number of entries |
| max-file-size | long | #e100000 | largest possible cached file |
An abstract class for caches.
=== ++(class cache-disk::cache ...)++ ===
cache-disk
^ fields ^ type ^ default value ^ short description ^
| path | string | _ | a file name |
| out | procedure | ++display++ | a procedure |
| max-file-size | elong | 4096 | maximum size of stored files |
This class specifies //cache// whose entries are stored on a disk.
The argument ++out++ is a procedure of two arguments that specify how the
value stored in the cache should be displayed. A good candidate is:
(lambda (o p) (xml-write o p (hop-xml-backend)))
=== ++(class cache-memory::cache ...)++ ===
cache-memory
^ fields ^ type ^ default value ^ short description ^
| max-file-size | elong | 4096 | maximum size of stored files |
This class specifies //cache// whose entries are stored in memory
=== ++(class cache-entry ...)++ ===
cache-entry
^ fields ^ type ^ default value ^ short description ^
| value | obj | _ | the cached value |
| signature | elong | _ | the entry's signature |
| upath | bstring | _ | the entry's key |
This class specifies //cache// whose entries are stored in memory
=== ++(registered-caches)++ ===
registered-caches
^ arguments ^ type ^ short description ^
The function ++registered-caches++ returns the list of all caches
currently in use.
=== ++(unregister-cache! cache)++ ===
unregister-cache!
^ arguments ^ type ^ short description ^
| cache | ::cache | the cache. |
This function //unregisters// a cache. The list returned by following
calls to ++registerec-caches++ won't contain this ++cache++ any longer.
=== ++(cache-clear cache)++ ===
cache-clear
^ arguments ^ type ^ short description ^
| cache | ::cache | the cache. |
This function //resets// a cache. That is, it invalidates all the entries
of the cache.
=== ++(cache->list cache)++ ===
cache->list
^ arguments ^ type ^ short description ^
| cache | ::cache | the cache. |
Returns a list whose elements are the entries of the cache.
=== ++(cache-get cache key)++ ===
cache-get
^ arguments ^ type ^ short description ^
| cache | ::cache | the cache. |
| key | string | the key. |
Gets the element store in the ++cache++ under the ++key++. If no element
is found ++#f++ is returned, otherwise returns an instance of the
the ++cache-entry++ class.
=== ++(cache-put! cache key value)++ ===
cache-put!
^ arguments ^ type ^ short description ^
| cache | ::cache | the cache. |
| key | string | the key. |
| value | obj | the stored value. |
Adds the element ++value++ in the ++cache++ under the ++key++.
== See also ==
registered-caches, unregister-cache!, cache-clear, cache-get, cache-put!, cache->list