# uproot.LRUArrayCache

Defined in uproot.cache on line 168.

Inheritance order:
uproot.LRUCache `collections.abc.MutableMapping` `collections.abc.Mapping` `collections.abc.Collection` `collections.abc.Sized` `collections.abc.Iterable` `collections.abc.Container`

class uproot.cache.LRUArrayCache(limit_bytes)
  Parameters:

    limit_bytes (None, int, or str) – Amount of data to allow in the cache before evicting the least-recently used. An integer is interpreted as a number of bytes and a string must be a number followed by a unit, such as “100 MB”. If None, this cache never evicts.

  LRUArrayCache is a `MutableMapping` that evicts the least-recently used objects when the `current` number of bytes exceeds the `limit`. The size of an object is taken from its `nbytes` attribute. If it does not have an `nbytes`, it is presumed to have `default_nbytes`.

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

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

  This cache is sensitive to the size of the objects it stores, but only if those objects have meaningful `nbytes`. It is therefore a better `array_cache` than an `array_cache`.

## sizeof

Inherited from uproot.LRUCache.

classmethod LRUArrayCache.sizeof(what)

  The “size of” an object in this cache is its

  - `nbytes` attribute/property if it has one (NumPy and Awkward Arrays, Pandas Series),

  - `memory_usage().sum()` if it exists (Pandas DataFrames),

  - `default_nbytes` otherwise.

## limit

Inherited from uproot.LRUCache.

LRUArrayCache.limit

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

## current

Inherited from uproot.LRUCache.

LRUArrayCache.current

  Current number of bytes in the cache.

## keys

Inherited from uproot.LRUCache.

LRUArrayCache.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

Inherited from uproot.LRUCache.

LRUArrayCache.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

Inherited from uproot.LRUCache.

LRUArrayCache.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.)