Create a new instance.
Options for creating a new instance.
options - the options used to create the instance.
Readonly
dbLevel database instance
Readonly
eventsEvent emitter for cache events
Readonly
maxMax age of cached data in milliseconds. Defaults to 0 (no max age).
Static
Readonly
optionsDefault options for creating new instances
All emitted event names.
Delete all expired data.
Protected
emitProtected
ensureGet a value for a given hash key if it exists. If the does not exist, returns a value from the api by invoking the provided function and then stores that value in the cache.
The hash key.
function that returns a new value for a given key if it doesn't exist in the cache.
hit - if the value exists in the cache.
miss - if the value does not exist in the cache.
Protected
isProtected
orShorthand for try/catch block with error-handling. Wrap a function call in a try catch block and emit an error event if an error occurs.
The function to wrap.
The return value of the provided function.
error - if the provided function throws an error.
Protected
parseProtected
parseProtected
serializeGenerated using TypeDoc
Persistent API response cache based on level-db.