QueueMemoryStorage
Class representing a memory storage manager.
Signature
export declare class QueueMemoryStorage<T extends QueueJSON = QueueJSON> extends QueueStorageAdapter<T>JSDoc
@classQueueMemoryStorage@extendsQueueStorageAdapter
Methods
get(key: string): T | undefined;Get the value using the key.
Parameters
key- The key to get the value from.
Returns
The value of the key.
Examples
const value = await storage.get("key");
console.log(value); // "value"set(key: string, value: T): void;Set the value using the key.
Parameters
key- The key to set the value to.
value- The value to set.
Returns
Did you know this can be async?
Examples
await storage.set("key", "value");delete(key: string): boolean;Delete the value using the key.
Parameters
key- The key to delete the value from.
Returns
Returns true if the key was deleted.
Examples
const success = await storage.delete("key");
console.log(success); // trueclear(): void;Clear the storage.
Returns
Scary, right?
Examples
await storage.clear();has(key: string): boolean;Check if the storage has the key.
Parameters
key- The key to check.
Returns
Return true if the key exists.
Examples
const exists = await storage.has("key");
console.log(exists); // trueparse(value: unknown): T;Parse the value.
Parameters
value- The value to parse.
Returns
The parsed value.
Examples
const parsed = await storage.parse("{'key':'value'}");
console.log(parsed); // { key: "value" }stringify<R = string>(value: unknown): R;Stringify the value.
Parameters
value- The value to stringify.
Returns
The stringified value.
Examples
const stringified = await storage.stringify({ key: "value" });
console.log(stringified); // "{'key':'value'}"