NoCache

class hybrid_learning.datasets.caching.NoCache[source]

Bases: Cache

Dummy cache that has no effect.

Public Methods:

put(descriptor, obj)

Store obj in this cache.

load(descriptor)

Load the object stored under key descriptor from cache.

descriptors()

Return all descriptors for which an element is cached.

clear()

Clear the current cache.

Inherited from : py: class:Cache

put(descriptor, obj)

Store obj in this cache.

load(descriptor)

Load the object stored under key descriptor from cache.

put_batch(descriptors, objs)

Store a batch of objs in this cache using according descriptors.

load_batch(descriptors[, return_none_if])

Load a batch of objects.

clear()

Clear the current cache.

descriptors()

Return all descriptors for which an element is cached.

as_dict()

Return a dict with all cached descriptors and objects.

wrap(getitem[, descriptor_map])

Add this cache to the deterministic function getitem (which should have no side effects).

Special Methods:

__add__(other)

Return a (cascaded) cache which will first lookup self then other with default sync mode.

__radd__(other)

Return a (cascaded) cache which will first lookup other then self with default sync mode.

Inherited from : py: class:Cache

__repr__()

Return repr(self).

__add__(other)

Return a (cascaded) cache which will first lookup self then other with default sync mode.

__radd__(other)

Return a (cascaded) cache which will first lookup other then self with default sync mode.


__add__(other)[source]

Return a (cascaded) cache which will first lookup self then other with default sync mode. In case other is None or a dummy NoCache, return self.

Returns

one of the summands in case the other is a no-op, else a CacheCascade transforms.

Parameters

other (Optional[Cache]) –

Return type

Cache

__radd__(other)[source]

Return a (cascaded) cache which will first lookup other then self with default sync mode. See __add__().

Parameters

other (Optional[Cache]) –

Return type

Cache

clear()[source]

Clear the current cache.

descriptors()[source]

Return all descriptors for which an element is cached.

Return type

Iterable

load(descriptor)[source]

Load the object stored under key descriptor from cache. None is returned if the object is not in the cache.

Parameters

descriptor (Hashable) –

Return type

Optional[Any]

put(descriptor, obj)[source]

Store obj in this cache. In case it already exists, the existing object is overwritten.

Parameters
  • descriptor (Hashable) – the descriptor key under which to store the object; used to access the object later

  • obj (Any) – the object to put into cache; must not be None