internal package
Foswiki::Cache
internal package
Foswiki::Cache
Virtual base class for cache implementations. A cache implementation is
used by
Foswiki::PageCache to store cached data (both page data and meta-data
about the cached pages).
ClassMethod
new( $session ) → $object
Construct a new cache delegator.
ObjectMethod
init($session)
Initializes a cache object to be used for the current request. this
object might be
shared on multiple requests when Foswiki is accelerated
using mod_perl or speedy-cgi and using the
Foswiki::Cache::MemoryCache
handler.
Subclasses should call up to this method at the start of overriding
implementations.
ObjectMethod
DESTROY()
Explicit destructor to break cyclic links.
ObjectMethod
finish()
Clean up internal structures
ObjectMethod
genkey($string, $key) → $key
Generate a key for the current cache.
Some cache implementations don't have a namespace feature. Those
which do are only able to serve objects from within one namespace
per cache object.
So by default we encode the namespace into the key here, even when this is
redundant, given that you specify the namespace for Cache::Cache
implementations during the constructor already.
ObjectMethod
set($key, $object ... ) → $boolean
Cache an $object under the given $key. Note that the
object won't be flushed to disk until we called finish().
Returns true if it was stored sucessfully
ObjectMethod
get($key) → $object
Retrieve a cached object, returns undef if it does not exist
ObjectMethod
delete($key) → $boolean
Delete an entry for a given $key
Returns true if the key was found and deleted, and false otherwise
ObjectMethod
clear()
Removes all objects from the cache.