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(self, key)[source]

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

Parameters

key (Any) – Key to query.

Returns

Cached value or None.

Return type

Any

put(self, key, value)[source]

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

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

  • value (Any) – Value to cache.

Return type

None

clear(self)[source]

Clears the cache.

Return type

None