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

Class BlosxomCacheBase

source code

Known Subclasses:
BlosxomCache, entrypickle.BlosxomCache, entryshelve.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.

Instance Methods [hide private]
 
__delitem__(self, key)
Convenience function to make this look more like a dict.
source code
 
__getitem__(self, key)
Convenience function to make this class look like a dict.
source code
 
__init__(self, req, config)
Constructor - setup and load up the cache
source code
 
__setitem__(self, key, value)
Synonymous to saveEntry
source code
 
close(self)
Override this to close your cache if necessary.
source code
 
get(self, key, default=None)
Convenience function to make this look more like a dict.
source code
 
getEntry(self)
Gets the data from the cache, returns a dict or an empty dict.
source code
 
has_key(self, key)
Convenience function to make this look more like a dict.
source code
boolean
isCached(self)
Returns 0 or 1 based on whether there is cached data, returns 0 is cache data is stale
source code
 
keys(self)
List out a list of keys for the cache, to be overridden by a subclass if a full dict interface is required.
source code
 
load(self, entryid)
Try to load up the cache with entryid (a unique key for the entry)
source code
 
rmEntry(self)
Remove cache entry: This is not used by pyblosxom, but used by utilities.
source code
 
saveEntry(self, entrydata)
Store entrydata in cache
source code
Instance Variables [hide private]
string _config
String containing config on where to store the cache.
Method Details [hide private]

__init__(self, req, config)
(Constructor)

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

isCached(self)

source code 
Returns 0 or 1 based on whether there is cached data, returns 0 is cache data is stale
Returns: boolean
0 or 1 based on cache

load(self, entryid)

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

saveEntry(self, entrydata)

source code 
Store entrydata in cache
Parameters:
  • entrydata (dict) - The payload, usually a dict

Instance Variable Details [hide private]

_config

String containing config on where to store the cache. The value of config is derived from py['cacheConfig'] in config.py.
Type:
string