LRUCache Class

Inheritance diagram of LRUCache

class LRUCache(capacity)

A simple LRU Cache implementation.

Methods

__init__(capacity)
clear() Clear the cache.
copy() Return an shallow copy of the instance.
get(key[, default]) Return an item from the cache dict or default
items() Return a list of items.
iteritems() Iterate over all items.
iterkeys() Iterate over all keys in the cache dict, ordered by
itervalue() Iterate over all values.
keys() Return a list of all keys ordered by most recent usage.
setdefault(key[, default]) Set default if the key is not in the cache otherwise leave unchanged.
values() Return a list of all values.

Descriptions

class LRUCache

Method details

__init__(capacity)
clear()

Clear the cache.

copy()

Return an shallow copy of the instance.

get(key, default=None)

Return an item from the cache dict or default

items()

Return a list of items.

iteritems()

Iterate over all items.

iterkeys()

Iterate over all keys in the cache dict, ordered by the most recent usage.

itervalue()

Iterate over all values.

keys()

Return a list of all keys ordered by most recent usage.

setdefault(key, default=None)

Set default if the key is not in the cache otherwise leave unchanged. Return the value of this key.

values()

Return a list of all values.

Table Of Contents

Previous topic

Joiner Class

Next topic

allocate_lock