Padloc Logo Docs & Resources

Class: MemoryStorage

storage.MemoryStorage

Basic in-memory storage. Useful for testing purposes

Implements

Constructors

constructor

new MemoryStorage()

Properties

_storage

Private _storage: Map<string, object>

Defined in

core/src/storage.ts:62

Methods

clear

clear(): Promise<void>

Deletes all data in this storage

Returns

Promise<void>

Implementation of

Storage.clear

Defined in

core/src/storage.ts:81


delete

delete<T>(obj): Promise<void>

Deletes an object

Type parameters

Name Type
T extends Storable<T>

Parameters

Name Type
obj T

Returns

Promise<void>

Implementation of

Storage.delete

Defined in

core/src/storage.ts:77


get

get<T>(cls, id): Promise<T>

Retrieves an object of type T based on its id

Type parameters

Name Type
T extends Storable<T>

Parameters

Name Type
cls T | StorableConstructor<T>
id string

Returns

Promise<T>

Implementation of

Storage.get

Defined in

core/src/storage.ts:68


list

list<T>(cls, __namedParameters?): Promise<T[]>

Retrieves an object of type T based on its id

Type parameters

Name Type
T extends Storable<T>

Parameters

Name Type
cls StorableConstructor<T>
__namedParameters StorageListOptions<T>

Returns

Promise<T[]>

Implementation of

Storage.list

Defined in

core/src/storage.ts:85


save

save<T>(obj): Promise<void>

Saves an object to the storage

Type parameters

Name Type
T extends Storable<T>

Parameters

Name Type
obj T

Returns

Promise<void>

Implementation of

Storage.save

Defined in

core/src/storage.ts:64