Part of bzrlib.fifo_cache View In Hierarchy
Known subclasses: bzrlib.fifo_cache.FIFOSizeCache
Method | __init__ | Undocumented |
Method | __setitem__ | Add a value to the cache, there will be no cleanup function. |
Method | __delitem__ | Undocumented |
Method | add | Add a new value to the cache. |
Method | cache_size | Get the number of entries we will cache. |
Method | cleanup | Clear the cache until it shrinks to the requested size. |
Method | clear | Clear out all of the cache. |
Method | resize | Increase/decrease the number of cached entries. |
Method | copy | Undocumented |
Method | pop | Undocumented |
Method | popitem | Undocumented |
Method | setdefault | similar to dict.setdefault |
Method | update | Similar to dict.update() |
Method | _remove | Remove an entry, making sure to call any cleanup function. |
Method | _remove_oldest | Remove the oldest entry. |
Also, if the entry is ever removed from the queue, call cleanup. Passing it the key and value being removed.
Parameters | key | The key to store it under |
value | The object to store | |
cleanup | None or a function taking (key, value) to indicate 'value' should be cleaned up |
This does not completely wipe the cache, just makes sure it is under the after_cleanup_count.
Parameters | max_cache | The maximum number of entries to cache. |
after_cleanup_count | After cleanup, we should have at most this many entries. This defaults to 80% of max_cache. |