maestral.utils.caches

Module containing cache implementations.

Module Contents

Classes

LRUCache

A simple LRU cache implementation

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

A simple LRU cache implementation

Parameters

capacity – Maximum number of of entries to keep.

get(self, key: Any) → Any[source]

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

Parameters

key – Key to query.

Returns

Cached value or None.

put(self, key: Any, value: Any)None[source]

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

Parameters
  • key – Key to use. Must be hashable.

  • value – Value to cache.

clear(self)None[source]

Clears the cache.