The type of the data to serialize and deserialize.
The type of the data to store.
Creates a new instance of the StorageDriver
class.
The name of the storage driver.
The serializer to use for serializing and deserializing data.
If driver does not support onUpdate, use this to notify with external event.
Optional
processor: Loadable<IStoreProcessor<Output>>The store processor to use for processing data before it is written to storage and after it is loaded from storage.
Optional
logger: ILoggerLikeThe logger to use for logging messages.
Readonly
bandwidthIndicates the speed of the storage driver.
Readonly
loggerReadonly
nameThe name of the storage driver.
Readonly
serializerIndicates whether or not the storage driver has been initialized.
Clear the stored data
Clear the stored data and return the Promise of Result.
A promise of Result that resolves when the data has been successfully cleared.
Retrieves the processor for the storage driver if it is available.
The processor for the storage driver, or undefined
if no processor is available.
Retrieves the processor for the storage driver if it is available and returns the Promise of Result.
The processor for the storage driver, or undefined
if no processor is available.
Get the serializer for the storage driver.
The serializer for the storage driver.
Protected
handleClear the stored data in storage.
A promise that resolves when the data has been successfully cleared.
Protected
handleRetrieve the data from storage.
A promise that resolves to the retrieved data, or undefined
if no data was found.
Protected
handleInitialize the storage driver.
A promise that resolves to true
if the storage driver was successfully initialized, or false
otherwise.
Protected
handleStore the given data to storage.
A promise that resolves when the data has been successfully stored.
Protected
handleCalled when the storage driver is unloaded.
A promise that resolves to true
if the storage driver was successfully unloaded, or false
otherwise.
Protected
handleUse this to indicate that the data has been updated.
Retrieves the data stored using the specified key.
The options to use for hydrating the data.
The retrieved data, or undefined
if no data was found.
Retrieves the data stored using the specified key and returns the Promise of Result.
Optional
options: IHydrateOptionsThe options to use for hydrating the data.
Promise of Result that resolves to the retrieved data, or undefined
if no data was found.
Initializes the storage driver.
A promise that resolves to true
if the storage driver was successfully initialized, or false
otherwise.
Initializes the storage driver and returns the Promise of Result.
Promise of the result object, see Result
Set the data to store and emit an update.
The data to store.
A promise that resolves when the data has been successfully stored.
Stores the given data using the specified key.
The data to store.
Stores the given data using the specified key and returns the Promise of Result.
The data to store.
A promise of Result that resolves when the data has been successfully stored.
Build the default JSON representation of the storage driver.
The JSON representation of the storage driver.
Returns a string representation of an object.
Unload the storage driver.
A promise that resolves to true
if the storage driver was successfully unloaded, or false
otherwise.
Unload the storage driver and return the Promise of Result.
A promise of Result that resolves to true
if the storage driver was successfully unloaded, or false
otherwise.
A storage driver that stores data in memory.
Since
v0.6.0
Example