Interface: SimpleStore
Defined in: core/src/SimpleStore.ts:22
Defines an interface for a simple key-value storage system that stores temporary records with a specified lifetime (TTL) and size. Supports the storage and retrieval of individual records as well as sets of records.
Properties
defaultTTL
defaultTTL:
number
Defined in: core/src/SimpleStore.ts:24
The default record TTL (in seconds).
maxSize
maxSize:
number
Defined in: core/src/SimpleStore.ts:26
The maximum number of records to store.
Methods
clear()
clear():
void|Promise<void>
Defined in: core/src/SimpleStore.ts:31
Deletes all entries in the storage system.
Returns
void | Promise<void>
delete()
delete(
id):void|Promise<void>
Defined in: core/src/SimpleStore.ts:37
Deletes a single record with the given id.
Parameters
id
string
The id of the record to delete.
Returns
void | Promise<void>
deleteMany()
deleteMany(
ids):void|Promise<void>
Defined in: core/src/SimpleStore.ts:43
Deletes the records associated with the list of given ids.
Parameters
ids
string[]
The list of ids to delete.
Returns
void | Promise<void>
deleteSet()
deleteSet(
id):void|Promise<void>
Defined in: core/src/SimpleStore.ts:49
Deletes the set of records associated with the given id.
Parameters
id
string
Returns
void | Promise<void>
load()
load(
id):Record<string,any> |Promise<Record<string,any> |undefined> |undefined
Defined in: core/src/SimpleStore.ts:55
Retrieves a single record with the given id.
Parameters
id
string
The id of the record to retrieve.
Returns
Record<string, any> | Promise<Record<string, any> | undefined> | undefined
loadMany()
loadMany(
ids): (Record<string,any> |undefined)[] |Promise<(Record<string,any> |undefined)[]>
Defined in: core/src/SimpleStore.ts:61
Retrieves the list of records for the given list of ids.
Parameters
ids
string[]
The list of ids of records to retrieve.
Returns
(Record<string, any> | undefined)[] | Promise<(Record<string, any> | undefined)[]>
loadSet()
loadSet(
id): (Record<string,any> |undefined)[] |Promise<(Record<string,any> |undefined)[] |undefined> |undefined
Defined in: core/src/SimpleStore.ts:67
Retrieves the set of records with the given id.
Parameters
id
string
Returns
(Record<string, any> | undefined)[] | Promise<(Record<string, any> | undefined)[] | undefined> | undefined
save()
save(
id,data,ttl?):void|Promise<void>
Defined in: core/src/SimpleStore.ts:77
Stores a single record with the given id for the specified TTL.
Parameters
id
string
The id of the record to retrieve.
data
Record<string, any>
The record to store.
ttl?
number
The number of seconds that the record will be stored.
Returns
void | Promise<void>
saveMany()
saveMany(
ids,data,ttl?):void|Promise<void>
Defined in: core/src/SimpleStore.ts:85
Stores a list of records with the given list of ids for the specified TTL.
Parameters
ids
string[]
data
Record<string, any>[]
The list of records to store.
ttl?
number
The number of seconds that each record will be stored.
Returns
void | Promise<void>
saveSet()
saveSet(
id,data,idProp,ttl?):void|Promise<void>
Defined in: core/src/SimpleStore.ts:94
Stores a set of records with the given id for the specified TTL.
Parameters
id
string
The id of the record set to store.
data
Record<string, any>[]
The record to store.
idProp
string
The name of the property in data to use as an id for storage.
ttl?
number
The number of seconds that the set will be stored.
Returns
void | Promise<void>