uproot.LRUCache

Defined in uproot.cache on line 23.

Inheritance order:

  1. collections.abc.MutableMapping

  2. collections.abc.Mapping

  3. collections.abc.Collection

  4. collections.abc.Sized

  5. collections.abc.Iterable

  6. collections.abc.Container

class uproot.cache.LRUCache(limit)
Parameters:

limit (None or int) – Number of objects to allow in the cache before evicting the least-recently used. If None, this cache never evicts.

LRUCache is a MutableMapping that evicts the least-recently used objects when the current number of objects exceeds the limit.

Get and set (or explicitly remove) items with MutableMapping syntax: square bracket subscripting.

LRUCache is thread-safe for all options: getting, setting, deleting, iterating, listing keys, values, and items.

This cache is insensitive to the size of the objects it stores, and hence is a better object_cache than an array_cache (cf. uproot.LRUArrayCache).

sizeof

classmethod LRUCache.sizeof(obj)

The “size of” an object in this cache is always exactly 1.

limit

LRUCache.limit

Number of objects to allow in the cache before evicting the least-recently used. If None, this cache never evicts.

current

LRUCache.current

Current number of items in the cache.

keys

LRUCache.keys()

Returns a copy of the keys currently in the cache, in least-recently used order.

The list ascends from least-recently used to most-recently used: index 0 is the least-recently used and index -1 is the most-recently used.

(Calling this method does not change the order.)

values

LRUCache.values()

Returns a copy of the values currently in the cache, in least-recently used order.

The list ascends from least-recently used to most-recently used: index 0 is the least-recently used and index -1 is the most-recently used.

(Calling this method does not change the order.)

items

LRUCache.items()

Returns a copy of the items currently in the cache, in least-recently used order.

The list ascends from least-recently used to most-recently used: index 0 is the least-recently used and index -1 is the most-recently used.

(Calling this method does not change the order.)