openpathsampling.netcdfplus.cache.WeakLRUCache

class openpathsampling.netcdfplus.cache.WeakLRUCache(size_limit=100, weak_type='value')[source]

Implements a cache that keeps weak references to all elements

In addition it uses a simple Least Recently Used Cache to make sure a portion of the last used elements are still present. Usually this number is 100.

__init__(size_limit=100, weak_type='value')[source]
Parameters:

size_limit (int) – integer that defines the size of the LRU cache. Default is 100.

Methods

__init__([size_limit, weak_type])

clear()

get(item[, default])

get value by key if it exists, None else

get_silent(item)

Return item from the without reordering the LRU

keys()

transfer(old_cache)

Transfer values between caches

values()

Attributes

count

the number of strong references int : the number of weak references

size

the maximal number of strong references, -1 if infinite int : the maximal number of weak references, -1 if infinite

size_limit