This software is owned by The university of California, Irvine,
and is not distributed under
any version of the GPL. GPL is a fine series of licenses, but the owners of the software need it to be distributed under these terms.
cachedb is a dictionary-like database wrapper that can greatly improve the
performance of some kinds of database operation. Beyond allowing write-through
and write-back element caching, the module also allows you to specific
disk-to-core (from_string) and core-to-disk (to_string) transparent conversion
functions that will only be used as little as possible.
IOW, if you read an item off of disk, it will transparently be converted to an
in-core representation. If you change it, and the cache isn't overflowing, the
new version won't be re-converted back to the disk format or written to disk
The most similar to cachedb.py appears to be shelve.py.
Both give the appearance of storing arbitrary objects in a disk-based database via the usual dict[key], dict[key] = value, dict.keys(),
del dict[key] and so forth, after the dict has been created.
Both implement caching
Neither shelve.py nor cachedb.py will transparently convert your keys to strings - they both only convert the values under those
keys to strings transparently.
It appears that while cachedb.py requires you to specify "object to string" and "string to object" conversion functions at database
creation time, shelve.py attempts to (and usually succeeds in) use the pickling that comes with python.
It appears that if you use a writeback version of shelve.py, then it will attempt to cache all used items in memory, while
cachedb.py allows you to specify how many items to cache and how often to flush the least recently used items from the cache.
shelve.py has a sync() method, while until today (Fri Feb 17 11:15:59 PST 2006), cachedb.py had a flush() method.
However, cachedb.py now has sync() as a synonym for flush().
Assume that you have a shelve or cachedb and the values stored in them are lists of numbers. The means of appending a number to the
With shelve.py, you would:
list = shelf[key]
shelf[key] = list
While with cachedb.py you would:
Sat Feb 18 22:26:50 PST 2006 - totally redid the aging algorithm tonight