Package park :: Package core :: Module datastore :: Class FileCache

Class FileCache

source code


Create a data cache in a particular directory on the filesystem.

Each cached item consists of two parts, a .key file containing the item description, and a .dat file containing the item data.

The store method returns a complete path to the .dat file.

TODO: monitor access times so that we can identify old files for purging

Instance Methods
 
__init__(self, location=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
hash(self, key)
Returns cache file and key file names for the given key.
source code
 
remove(self, key)
Remove file associated with key.
source code
 
store(self, key)
Find the data file corresponding to the particular key.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Instance Variables
  location
Directory name containing the cache
Properties

Inherited from object: __class__

Method Details

__init__(self, location=None)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

store(self, key)

source code 

Find the data file corresponding to the particular key.

Raises RuntimeError if there is a key collision.