maestral.utils.caches

Module containing cache implementations.

Module Contents

class maestral.utils.caches.LRUCache(capacity)[source]

A simple LRU cache implementation

Parameters:

capacity (int) – Maximum number of entries to keep.

get(key)[source]

Get the cached value for a key. Mark as most recently used.

Parameters:

key (Hashable) – Key to query.

Returns:

Cached value or None.

Return type:

Any

put(key, value)[source]

Set the cached value for a key. Mark as most recently used.

Parameters:
  • key (Hashable) – Key to use. Must be hashable.

  • value (Any) – Value to cache.

Return type:

None

clear()[source]

Clears the cache.

Return type:

None