internal package Foswiki::Cache

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

  • Foswiki::Cache::BDB - Implementation of a Foswiki::Cache using BerkeleyDB. See Foswiki::Cache for details of the methods implemented by this class.
  • Foswiki::Cache::DB_File - Implementation of a Foswiki::Cache using DB_File. See Foswiki::Cache for details of the methods implemented by this class.
  • Foswiki::Cache::FileCache - Implementation of a Foswiki::Cache using Cache::FileCache. See Foswiki::Cache for details of the methods implemented by this class.
  • Foswiki::Cache::Memcached - implementation of a Foswiki::Cache using memcached. See Foswiki::Cache for details of the methods implemented by this class.
  • Foswiki::Cache::MemoryLRU - Implementation of a Foswiki::Cache using an in-memory perl hash. See Foswiki::Cache for details of the methods implemented by this class.

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.

This topic: System > WebHome > ReferenceManual > DeveloperDocumentationCategory > PerlDoc
Topic revision: 19 Apr 2011, ProjectContributor
 
This site is powered by FoswikiCopyright &© by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding BACCHUS Wiki? Send feedback