maestral.utils.caches

Module containing cache implementations.

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

Bases: object

A simple LRU cache implementation

Parameters

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

Return type

None

get(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(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()[source]

Clears the cache.

Return type

None