s.c.Cache(object) : class documentation

Part of storm.cache View In Hierarchy

Prevents recently used objects from being deallocated.

This prevents recently used objects from being deallocated by Python even if the user isn't holding any strong references to it. It does that by holding strong references to the objects referenced by the last N obj_infos added to it (where N is the cache size).

Method __init__ Undocumented
Method clear Clear the entire cache at once.
Method add Add obj_info as the most recent entry in the cache.
Method remove Remove obj_info from the cache, if present.
Method set_size Set the maximum number of objects that may be held in this cache.
Method get_cached Return an ordered list of the currently cached obj_infos.
def __init__(self, size=1000):
Undocumented
def clear(self):
Clear the entire cache at once.
def add(self, obj_info):
Add obj_info as the most recent entry in the cache.

If the obj_info is already in the cache, it remains in the cache and has its order changed to become the most recent entry (IOW, will be the last to leave).

def remove(self, obj_info):
Remove obj_info from the cache, if present.
ReturnsTrue if obj_info was cached, False otherwise.
def set_size(self, size):
Set the maximum number of objects that may be held in this cache.

If the size is reduced, older obj_infos may be dropped from the cache to respect the new size.

def get_cached(self):
Return an ordered list of the currently cached obj_infos.

The most recently added objects come first in the list.

API Documentation for storm, generated by pydoctor at 2011-03-15 08:53:51.