Package Pyblosxom :: Package cache :: Module base :: Class BlosxomCacheBase
[show private | hide private]
[frames | no frames]

Class BlosxomCacheBase

Known Subclasses:
BlosxomCache, BlosxomCache, BlosxomCache

Base Class for Caching stories in pyblosxom.

A cache is a disposable piece of data that gets updated when an entry is in a fresh state.

Drivers are to subclass this object, overriding methods defined in this class. If there is an error in creating cache data, be as quite as possible, document how a user could check whether his cache works.

Driver should expect empty caches and should attempt to create them from scratch.
Method Summary
  __init__(self, req, config)
Constructor - setup and load up the cache
  __delitem__(self, key)
  __getitem__(self, key)
Convenience function to make this class look like a dict
  __setitem__(self, key, value)
Synonymous to saveEntry
  close(self)
Close your cache if necessary.
  get(self, key, default)
  getEntry(self)
Gets the data from the cache, returns a dict or an empty dict.
  has_key(self, key)
boolean isCached(self)
Returns 0 or 1 based on whether there is cached data, returns 0 is cache data is stale
  keys(self)
List out a list of keys for the cache, to be overridden by a subclass if a full dict interface is required.
  load(self, entryid)
Try to load up the cache with entryid (a unique key for the entry)
  rmEntry(self)
Remove cache entry: This is not used by pyblosxom, but used by utilities
  saveEntry(self, entrydata)
Store entrydata in cache

Method Details

__init__(self, req, config)
(Constructor)

Constructor - setup and load up the cache
Parameters:
req - the request object
           (type=Request)
config - String containing config on where to store the cache
           (type=string)

__getitem__(self, key)
(Indexing operator)

Convenience function to make this class look like a dict

__setitem__(self, key, value)
(Index assignment operator)

Synonymous to saveEntry

close(self)

Close your cache if necessary.

getEntry(self)

Gets the data from the cache, returns a dict or an empty dict.

isCached(self)

Returns 0 or 1 based on whether there is cached data, returns 0 is cache data is stale
Returns:
0 or 1 based on cache
           (type=boolean)

keys(self)

List out a list of keys for the cache, to be overridden by a subclass if a full dict interface is required.

load(self, entryid)

Try to load up the cache with entryid (a unique key for the entry)
Parameters:
entryid - The key identifier for your cache
           (type=string)

rmEntry(self)

Remove cache entry: This is not used by pyblosxom, but used by utilities

saveEntry(self, entrydata)

Store entrydata in cache
Parameters:
entrydata - The payload, usually a dict
           (type=dict)

Generated by Epydoc 2.1 on Tue Feb 7 21:43:57 2006 http://epydoc.sf.net