The LoadNCache constructor accept an options object. If default options are ok for you then you can pass in a function. Passing a function is equivalent to passing only the loader option in the options parameter.
Instance settings or a load function.
Private
Optional
Readonly
autoflushAutoflushManager casted to right type.
Private
Readonly
configThe actual configuration including defaults.
Private
firstIs this the first time we load a value?
Private
Optional
metadataMetadata associated to the promise below.
Private
Readonly
persistencePersistence manager casted to right type.
Private
Optional
promiseThe promise holding the value.
Rest
...args: any[]Optional
context: anyPrivate
callPrivate
loadThis method load a new value from storage or by calling a loadFunction. As soon as the value is available (which can be also a rejected promise) its stored as a promise along with the timestamp.
Optional
fn: ((...args: any[]) => void)Rest
...args: any[]Optional
context: anyOptional
once: booleanAdd a listener for a given event.
Rest
...args: any[]Optional
context: anyAdd a one-time listener for a given event.
Rest
...args: any[]Optional
context: anyPrivate
prepareReturns a new flush callback.
the callback function.
The object that this callback will flush.
Remove all listeners, or those of the specified event.
Optional
event: string | symbolRemove the listeners of a given event.
Optional
fn: ((...args: any[]) => void)Rest
...args: any[]Optional
context: anyOptional
once: booleanPrivate
safelyPrivate
safelyCalls the persistenceManager saveValue method handling exceptions.
The PromiseWithMetadata object that stores the data to persist.
Generated using TypeDoc
The main class of this project. Check README.md for documentation.