Перейти к содержанию

Class: MemoryStorageDriver

A simple in-memory key-value storage for client apps

Implements

Constructors

constructor

new MemoryStorageDriver()

Methods

clear

clear(filter): Promise<number>

Deprecated

used for tracing

Parameters

Name Type
filter Partial<{ room: string ; topic: string }>

Returns

Promise<number>


find

find(filter): Promise<null | StoragePayload>

Deprecated

used for tracing

Parameters

Name Type
filter Partial<{ room: string ; topic: string }>

Returns

Promise<null | StoragePayload>


list

list(filter): Promise<StoragePayload[]>

Deprecated

used for tracing

Parameters

Name Type
filter Partial<{ room: string ; topic: string }>

Returns

Promise<StoragePayload[]>


read

read(meta): Promise<unknown>

Read data stored under the provided meta

This method is typically used in a permanent storage strategy

Parameters

Name Type Description
meta StorageMeta composite identifier

Returns

Promise<unknown>

stored data, or null if not found

Implementation of

StorageDriver.read


take

take(meta): Promise<unknown>

Take the data stored under the provided meta and remove original

This method is typically used in a temporary storage strategy and as a mean to delete stored entry

Parameters

Name Type Description
meta StorageMeta composite identifier

Returns

Promise<unknown>

stored data, or null if not found

Implementation of

StorageDriver.take


write

write(meta, data): Promise<void>

Write a unit of data into storage, uniquely identified by meta

If such unit of data already exists, it is silently overwritten

Parameters

Name Type Description
meta StorageMeta composite identifier
data unknown unit of data to insert

Returns

Promise<void>

Implementation of

StorageDriver.write