logalyzer.util.CacheManager(object)
class documentation
Part of logalyzer.util
(View In Hierarchy)
Let me manage a cache or two for you.
Method | __init__ | Undocumented |
Method | new | Generates the FIFO queue for a new sort-of LRU cache and returns its index, starting with 0 for the first cache. |
Method | clear | Clears all caches (or just the specified one) of all values (or just the specified value). |
Method | check | Checks cache k for the string x, returning True if it's there or False if not. |
Method | set | Appends x to cache k, which will result in it being found there if checked within N cache misses. |
Method | _checkIndex | Undocumented |
Generates the FIFO queue for a new sort-of LRU cache and returns its index, starting with 0 for the first cache.
Clears all caches (or just the specified one) of all values (or just the specified value).
Checks cache k for the string x, returning True if it's there or False if not.
Appends x to cache k, which will result in it being found there if checked within N cache misses.
The value least recently added (from a cache miss) will be popped off the other end and returned, unless it happens to equal the value just added. (This lets you use it to prune another list somewhere.) Mine isn't strictly an LRU cache, since a cache hit will get drowned in misses.
If nothing was popped off because the cache hasn't yet grown to N
elements yet, or the new value equals the popped-off one, the result will
be None
.