b.l.LRUCache(object) : class documentation

Part of bzrlib.lru_cache View In Hierarchy

Known subclasses: bzrlib.lru_cache.LRUSizeCache

A class which manages a cache of entries, removing unused ones.
Method __init__ Undocumented
Method __contains__ Undocumented
Method __getitem__ Undocumented
Method __len__ Undocumented
Method add Undocumented
Method __setitem__ Add a new value to the cache
Method cache_size Get the number of entries we will cache.
Method get Undocumented
Method keys Get the list of keys currently cached.
Method as_dict Get a new dict with the same key:value pairs as the cache
Method cleanup Clear the cache until it shrinks to the requested size.
Method clear Clear out all of the cache.
Method resize Change the number of entries that will be cached.
Method _record_access Record that key was accessed.
Method _remove_node Undocumented
Method _remove_lru Remove one entry from the lru, and handle consequences.
Method _update_max_cache Undocumented
def __init__(self, max_cache=100, after_cleanup_count=None):
Undocumented
def __contains__(self, key):
Undocumented
def __getitem__(self, key):
Undocumented
def __len__(self):
Undocumented
@symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 5, 0)))
def add(self, key, value, cleanup=None):
Undocumented
def __setitem__(self, key, value):
Add a new value to the cache
def cache_size(self):
Get the number of entries we will cache.
def get(self, key, default=None):
Undocumented
def keys(self):
Get the list of keys currently cached.

Note that values returned here may not be available by the time you request them later. This is simply meant as a peak into the current state.

ReturnsAn unordered list of keys that are currently cached.
def as_dict(self):
Get a new dict with the same key:value pairs as the cache
def cleanup(self):
Clear the cache until it shrinks to the requested size.

This does not completely wipe the cache, just makes sure it is under the after_cleanup_count.

def _record_access(self, node):
Record that key was accessed.
def _remove_node(self, node):
Undocumented
def _remove_lru(self):
Remove one entry from the lru, and handle consequences.

If there are no more references to the lru, then this entry should be removed from the cache.

def clear(self):
Clear out all of the cache.
def resize(self, max_cache, after_cleanup_count=None):
Change the number of entries that will be cached.
def _update_max_cache(self, max_cache, after_cleanup_count=None):
Undocumented
API Documentation for Bazaar, generated by pydoctor at 2019-07-21 00:34:56.