Class

HierarchicalObjectCache

HierarchicalObjectCache()

This class implements a hierarchical cache that establishes multiple levels of a cached hierarchy where the number of hierarchy levels depends on the number of arguments provided. The assumption is that the items must only be read once from a source and will not change after that - which makes caching possible.

The only function used to access the cache is called fetch.

Constructor

# new HierarchicalObjectCache()

View Source frontend/ipc/hierarchical_object_cache.js, line 26

Methods

# async fetch(fetchFunction, …args)

Checks whether there is already an object at the cache position based on the parameters and either returns it directly if existing or fetches it using the provided fetchFunction.

Parameters:
Name Type Attributes Description
fetchFunction function
args any <repeatable>

The provided arguments are used as keys for the hierarchical cache. With e.g. SWORD objects the hierarchy could be based on Module/Book/Chapter.

View Source frontend/ipc/hierarchical_object_cache.js, line 39

The value retrieved from cache if already existing or via the provided fetchFunction if not existing.