# new HierarchicalObjectCache()
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. |
The value retrieved from cache if already existing or via the provided fetchFunction if not existing.