import MultiStorage from 'typhonjs-core-multistorage/src/platforms/node/MultiStorage.js'
MultiStorage
Provides long or short term storage via node-localstorage or an in memory Map.
Constructor Summary
Public Constructor | ||
public |
constructor(mainKey: string, session: boolean, serializer: Object) Initializes MultiStorage. |
Member Summary
Public Members | ||
public get |
mainKey: *: * Gets the main key. |
|
public get |
serializer: *: * Gets the serializer. |
|
public get |
storageType: *: * Get storage type. |
Method Summary
Public Methods | ||
public |
Clears all entries associated with |
|
public |
Deletes entry filed under |
|
public |
Returns the value associated with |
|
public |
Returns the entire JSON object stored by |
|
public |
Sets a value by the give key in the |
|
public |
Sets an entire object to be serialized under |
Public Constructors
public constructor(mainKey: string, session: boolean, serializer: Object) source
Initializes MultiStorage. First parameter may be an optional object literal hash. When using an object hash
an additional parameter filePath
may specify a file path for local storage. By default the mainKey
is
used for the filePath
.
Public Members
Public Methods
public delete(key: string): Promise<boolean> source
Deletes entry filed under key
in mainKey
hash.
Params:
Name | Type | Attribute | Description |
key | string | Key to delete. |
public get(key: string): Promise<undefined> source
Returns the value associated with key
in mainKey
hash.
Params:
Name | Type | Attribute | Description |
key | string | Key to retrieve a value for. |