@codesoul-co/hypha-memory / working-store
- Package index:
@codesoul-co/hypha-memory - Source:
packages/memory/src/working-store.ts - Exports: 6
Using this module
Use the Working store module for persisting and reading data at this boundary. It exports 2 classes, 4 interfaces.
Import from the package entrypoint
ts
import {
InMemoryWorkingMemoryStore,
RedisWorkingMemoryStore,
} from '@codesoul-co/hypha-memory';
import type {
RedisLikeWorkingMemoryClient,
RedisWorkingMemoryStoreOptions,
WorkingMemoryEntry,
WorkingMemoryStore,
} from '@codesoul-co/hypha-memory';Usage patterns
- Use the 4 type/interface exports as static contracts in application code, adapters, or tests. Import them with
import type; they do not exist at runtime. - The module exposes 2 classes as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
InMemoryWorkingMemoryStore | class | new InMemoryWorkingMemoryStore(now?: () => Date): InMemoryWorkingMemoryStore | In Memory Working Memory Store class with 7 public constructor or member entries; its exact declarations are listed below. |
RedisWorkingMemoryStore | class | new RedisWorkingMemoryStore(options: RedisWorkingMemoryStoreOptions): RedisWorkingMemoryStore | Redis Working Memory Store class with 7 public constructor or member entries; its exact declarations are listed below. |
RedisLikeWorkingMemoryClient | interface | interface RedisLikeWorkingMemoryClient | Redis Like Working Memory Client interface with 5 public fields or methods. |
RedisWorkingMemoryStoreOptions | interface | interface RedisWorkingMemoryStoreOptions | Redis Working Memory Store Options interface with 7 public fields or methods. |
WorkingMemoryEntry | interface | interface WorkingMemoryEntry | Working Memory Entry interface with 8 public fields or methods. |
WorkingMemoryStore | interface | interface WorkingMemoryStore | Working Memory Store interface with 6 public fields or methods. |
InMemoryWorkingMemoryStore
In Memory Working Memory Store class with 7 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { InMemoryWorkingMemoryStore } from '@codesoul-co/hypha-memory'; - Source module:
working-store
Declaration
text
export declare class InMemoryWorkingMemoryStore implements WorkingMemoryStore {
constructor(now?: () => Date);
get<TValue = unknown>(scope: ManagedMemoryScope, id: string): Promise<WorkingMemoryEntry<TValue> | null>;
set<TValue = unknown>(entry: Omit<WorkingMemoryEntry<TValue>, 'scopeHash'>, ttlSeconds?: number): Promise<WorkingMemoryEntry<TValue>>;
delete(scope: ManagedMemoryScope, id: string): Promise<void>;
list<TValue = unknown>(scope: ManagedMemoryScope): Promise<Array<WorkingMemoryEntry<TValue>>>;
clearScope(scope: ManagedMemoryScope): Promise<void>;
health(): Promise<ProviderHealth>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
clearScope | method | clearScope(scope: ManagedMemoryScope): Promise<void> | Public method; parameters and return type are shown in the signature. |
constructor | constructor | (now?: () => Date): InMemoryWorkingMemoryStore | Creates an instance of this class. |
delete | method | delete(scope: ManagedMemoryScope, id: string): Promise<void> | Public method; parameters and return type are shown in the signature. |
get | method | get<TValue = unknown>(scope: ManagedMemoryScope, id: string): Promise<WorkingMemoryEntry<TValue> | null> | Public method; parameters and return type are shown in the signature. |
health | method | health(): Promise<ProviderHealth> | Public method; parameters and return type are shown in the signature. |
list | method | list<TValue = unknown>(scope: ManagedMemoryScope): Promise<Array<WorkingMemoryEntry<TValue>>> | Public method; parameters and return type are shown in the signature. |
set | method | set<TValue = unknown>(entry: Omit<WorkingMemoryEntry<TValue>, "scopeHash">, ttlSeconds?: number): Promise<WorkingMemoryEntry<TValue>> | Public method; parameters and return type are shown in the signature. |
RedisWorkingMemoryStore
Redis Working Memory Store class with 7 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { RedisWorkingMemoryStore } from '@codesoul-co/hypha-memory'; - Source module:
working-store
Declaration
text
export declare class RedisWorkingMemoryStore implements WorkingMemoryStore {
constructor(options: RedisWorkingMemoryStoreOptions);
get<TValue = unknown>(scope: ManagedMemoryScope, id: string): Promise<WorkingMemoryEntry<TValue> | null>;
set<TValue = unknown>(entry: Omit<WorkingMemoryEntry<TValue>, 'scopeHash'>, ttlSeconds?: number | undefined): Promise<WorkingMemoryEntry<TValue>>;
delete(scope: ManagedMemoryScope, id: string): Promise<void>;
list<TValue = unknown>(scope: ManagedMemoryScope): Promise<Array<WorkingMemoryEntry<TValue>>>;
clearScope(scope: ManagedMemoryScope): Promise<void>;
health(): Promise<ProviderHealth>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
clearScope | method | clearScope(scope: ManagedMemoryScope): Promise<void> | Public method; parameters and return type are shown in the signature. |
constructor | constructor | (options: RedisWorkingMemoryStoreOptions): RedisWorkingMemoryStore | Creates an instance of this class. |
delete | method | delete(scope: ManagedMemoryScope, id: string): Promise<void> | Public method; parameters and return type are shown in the signature. |
get | method | get<TValue = unknown>(scope: ManagedMemoryScope, id: string): Promise<WorkingMemoryEntry<TValue> | null> | Public method; parameters and return type are shown in the signature. |
health | method | health(): Promise<ProviderHealth> | Public method; parameters and return type are shown in the signature. |
list | method | list<TValue = unknown>(scope: ManagedMemoryScope): Promise<Array<WorkingMemoryEntry<TValue>>> | Public method; parameters and return type are shown in the signature. |
set | method | set<TValue = unknown>(entry: Omit<WorkingMemoryEntry<TValue>, "scopeHash">, ttlSeconds?: number | undefined): Promise<WorkingMemoryEntry<TValue>> | Public method; parameters and return type are shown in the signature. |
RedisLikeWorkingMemoryClient
Redis Like Working Memory Client interface with 5 public fields or methods.
- Kind: interface
- Import:
import type { RedisLikeWorkingMemoryClient } from '@codesoul-co/hypha-memory'; - Source module:
working-store
Declaration
text
export interface RedisLikeWorkingMemoryClient {
get(key: string): Promise<string | null>;
set(key: string, value: string, mode?: 'EX', durationSeconds?: number): Promise<unknown>;
del(...keys: string[]): Promise<number>;
scan(cursor: string, matchToken: 'MATCH', pattern: string, countToken: 'COUNT', count: number): Promise<[string, string[]]>;
ping?(): Promise<string>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
del | method | del(...keys: string[]): Promise<number> | Public method; parameters and return type are shown in the signature. |
get | method | get(key: string): Promise<string | null> | Public method; parameters and return type are shown in the signature. |
ping | method | ping?(): Promise<string> | Public method; parameters and return type are shown in the signature. |
scan | method | scan(cursor: string, matchToken: "MATCH", pattern: string, countToken: "COUNT", count: number): Promise<[string, string[]]> | Public method; parameters and return type are shown in the signature. |
set | method | set(key: string, value: string, mode?: "EX", durationSeconds?: number): Promise<unknown> | Public method; parameters and return type are shown in the signature. |
RedisWorkingMemoryStoreOptions
Redis Working Memory Store Options interface with 7 public fields or methods.
- Kind: interface
- Import:
import type { RedisWorkingMemoryStoreOptions } from '@codesoul-co/hypha-memory'; - Source module:
working-store
Declaration
text
export interface RedisWorkingMemoryStoreOptions {
client: RedisLikeWorkingMemoryClient;
namespace?: string;
defaultTtlSeconds?: number;
scanCount?: number;
scanBudget?: Partial<Omit<RedisScanBudget, 'count'>>;
now?: () => Date;
nowMs?: () => number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
client | property | client: RedisLikeWorkingMemoryClient | Public property; its type, readonly modifier and optionality are shown in the signature. |
defaultTtlSeconds | property | defaultTtlSeconds?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
namespace | property | namespace?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
now | method | now?(): Date | Public method; parameters and return type are shown in the signature. |
nowMs | method | nowMs?(): number | Public method; parameters and return type are shown in the signature. |
scanBudget | property | scanBudget?: Partial<Omit<RedisScanBudget, "count">> | Public property; its type, readonly modifier and optionality are shown in the signature. |
scanCount | property | scanCount?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
WorkingMemoryEntry
Working Memory Entry interface with 8 public fields or methods.
- Kind: interface
- Import:
import type { WorkingMemoryEntry } from '@codesoul-co/hypha-memory'; - Source module:
working-store
Declaration
text
export interface WorkingMemoryEntry<TValue = unknown> {
id: string;
scope: ManagedMemoryScope;
scopeHash: string;
value: TValue;
createdAt: string;
updatedAt: string;
expiresAt?: string;
metadata?: Record<string, unknown>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
createdAt | property | createdAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
expiresAt | property | expiresAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
id | property | id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
metadata | property | metadata?: Record<string, unknown> | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: ManagedMemoryScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
scopeHash | property | scopeHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
updatedAt | property | updatedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
value | property | value: TValue | Public property; its type, readonly modifier and optionality are shown in the signature. |
WorkingMemoryStore
Working Memory Store interface with 6 public fields or methods.
- Kind: interface
- Import:
import type { WorkingMemoryStore } from '@codesoul-co/hypha-memory'; - Source module:
working-store
Declaration
text
export interface WorkingMemoryStore {
get<TValue = unknown>(scope: ManagedMemoryScope, id: string): Promise<WorkingMemoryEntry<TValue> | null>;
set<TValue = unknown>(entry: Omit<WorkingMemoryEntry<TValue>, 'scopeHash'>, ttlSeconds?: number): Promise<WorkingMemoryEntry<TValue>>;
delete(scope: ManagedMemoryScope, id: string): Promise<void>;
list<TValue = unknown>(scope: ManagedMemoryScope): Promise<Array<WorkingMemoryEntry<TValue>>>;
clearScope(scope: ManagedMemoryScope): Promise<void>;
health(): Promise<ProviderHealth>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
clearScope | method | clearScope(scope: ManagedMemoryScope): Promise<void> | Public method; parameters and return type are shown in the signature. |
delete | method | delete(scope: ManagedMemoryScope, id: string): Promise<void> | Public method; parameters and return type are shown in the signature. |
get | method | get<TValue = unknown>(scope: ManagedMemoryScope, id: string): Promise<WorkingMemoryEntry<TValue> | null> | Public method; parameters and return type are shown in the signature. |
health | method | health(): Promise<ProviderHealth> | Public method; parameters and return type are shown in the signature. |
list | method | list<TValue = unknown>(scope: ManagedMemoryScope): Promise<Array<WorkingMemoryEntry<TValue>>> | Public method; parameters and return type are shown in the signature. |
set | method | set<TValue = unknown>(entry: Omit<WorkingMemoryEntry<TValue>, "scopeHash">, ttlSeconds?: number): Promise<WorkingMemoryEntry<TValue>> | Public method; parameters and return type are shown in the signature. |
