InMemoryReadModelStore
API reference for InMemoryReadModelStore
Class: InMemoryReadModelStore
Section titled “Class: InMemoryReadModelStore”In-memory implementation of the IReadModelStore interface Useful for testing and development
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new InMemoryReadModelStore():
InMemoryReadModelStore
Returns
Section titled “Returns”InMemoryReadModelStore
Methods
Section titled “Methods”batchDelete()
Section titled “batchDelete()”batchDelete(
keys
,options?
):Promise
<boolean
[]>
Batch deletion of multiple items
Parameters
Section titled “Parameters”string
[]
Array of keys to delete
options?
Section titled “options?”Optional settings for the batch delete operation
Returns
Section titled “Returns”Promise
<boolean
[]>
A promise that resolves with an array of booleans indicating success/failure
Implementation of
Section titled “Implementation of”batchGet()
Section titled “batchGet()”batchGet<
T
>(keys
,options?
):Promise
<object
[]>
Batch retrieval of multiple items by their keys
Type Parameters
Section titled “Type Parameters”T
= unknown
Parameters
Section titled “Parameters”string
[]
Array of keys to retrieve
options?
Section titled “options?”Optional settings for the batch get operation
Returns
Section titled “Returns”Promise
<object
[]>
A promise that resolves with an array of key-value pairs
Implementation of
Section titled “Implementation of”batchPut()
Section titled “batchPut()”batchPut<
T
>(items
,options?
):Promise
<void
>
Batch storage of multiple items
Type Parameters
Section titled “Type Parameters”T
= unknown
Parameters
Section titled “Parameters”object
[]
Array of key-value pairs to store
options?
Section titled “options?”WriteOptions
& ExpirationOptions
Optional settings for the batch put operation
Returns
Section titled “Returns”Promise
<void
>
A promise that resolves when all values have been stored
Implementation of
Section titled “Implementation of”clear()
Section titled “clear()”clear():
void
Clear all data (useful for testing)
Returns
Section titled “Returns”void
delete()
Section titled “delete()”delete(
key
,options?
):Promise
<boolean
>
Deletes a value by its key.
Parameters
Section titled “Parameters”string
The key of the value to delete
options?
Section titled “options?”Optional settings for the delete operation
Returns
Section titled “Returns”Promise
<boolean
>
A promise that resolves to true if the key existed and was deleted, false otherwise
Implementation of
Section titled “Implementation of”get<
T
>(key
,options?
):Promise
<null
|T
>
Retrieves a value by its key.
Type Parameters
Section titled “Type Parameters”T
= unknown
Parameters
Section titled “Parameters”string
The key of the value to retrieve
options?
Section titled “options?”Optional settings for the retrieval operation
Returns
Section titled “Returns”Promise
<null
| T
>
A promise that resolves with the value, or null if not found
Implementation of
Section titled “Implementation of”getAll()
Section titled “getAll()”getAll<
T
>(options?
):Promise
<object
[]>
Retrieves all values, optionally filtered by a key prefix.
Type Parameters
Section titled “Type Parameters”T
= unknown
Parameters
Section titled “Parameters”options?
Section titled “options?”Optional settings for retrieving all values
Returns
Section titled “Returns”Promise
<object
[]>
A promise that resolves with an array of key-value pairs
Implementation of
Section titled “Implementation of”getCapabilities()
Section titled “getCapabilities()”getCapabilities():
StoreCapabilities
Returns the capabilities of this store implementation
Returns
Section titled “Returns”Store capabilities object
Implementation of
Section titled “Implementation of”IReadModelStore
.getCapabilities
getNativeClient()
Section titled “getNativeClient()”getNativeClient<
C
>():C
Gets access to the native database client Allows for direct operations using the underlying database API
Type Parameters
Section titled “Type Parameters”C
= Map
<string
, unknown
>
Returns
Section titled “Returns”C
The native client instance
Implementation of
Section titled “Implementation of”IReadModelStore
.getNativeClient
listKeys()
Section titled “listKeys()”listKeys(
options?
):Promise
<{cursor?
:string
;keys
:object
[];list_complete
:boolean
; }>
Lists keys in the store, optionally filtered by prefix.
Parameters
Section titled “Parameters”options?
Section titled “options?”Optional settings for the list operation
cursor?
Section titled “cursor?”string
limit?
Section titled “limit?”number
prefix?
Section titled “prefix?”string
tableName?
Section titled “tableName?”string
Returns
Section titled “Returns”Promise
<{ cursor?
: string
; keys
: object
[]; list_complete
: boolean
; }>
A promise that resolves with the list result containing keys and metadata
Implementation of
Section titled “Implementation of”put<
T
>(key
,value
,options?
):Promise
<void
>
Stores a value with the given key. If the key already exists, the value will be overwritten.
Type Parameters
Section titled “Type Parameters”T
= unknown
Parameters
Section titled “Parameters”string
The key under which to store the value
T
The value to store (string, ArrayBuffer, or any type that can be serialized to JSON)
options?
Section titled “options?”WriteOptions
& ExpirationOptions
& MetadataOptions
Optional settings for the storage operation
Returns
Section titled “Returns”Promise
<void
>
A promise that resolves when the value has been stored
Implementation of
Section titled “Implementation of”query()
Section titled “query()”query<
T
>(options
):Promise
<object
[]>
Query items using filter criteria or options
Type Parameters
Section titled “Type Parameters”T
= unknown
Parameters
Section titled “Parameters”options
Section titled “options”QueryOptions
& object
Query options and filter criteria
Returns
Section titled “Returns”Promise
<object
[]>
A promise that resolves with matching items