Skip to content

@codesoul-co/hypha-memory / managed-search-cache

Using this module

Use the Managed search cache module for reading, writing, or coordinating cache state. It exports 3 classes, 2 constants, 3 functions, 8 interfaces, 4 types.

Import from the package entrypoint

ts
import {
  CachedMemoryManagementProvider,
  InMemoryMemorySearchCacheStore,
  RedisMemorySearchCacheStore,
  managedMemorySearchResultSchema,
  memorySearchCacheRecordSchema,
  composeMemorySearchCacheProvider,
  validateManagedMemorySearchResults,
  validateMemorySearchCacheRecord,
} from '@codesoul-co/hypha-memory';

import type {
  CachedMemoryManagementProviderOptions,
  InMemoryMemorySearchCacheOptions,
  MemorySearchCacheAuthorizationDecision,
  MemorySearchCacheAuthorizationPort,
  MemorySearchCacheEvent,
  MemorySearchCacheStore,
  RedisLikeMemorySearchCacheClient,
  RedisMemorySearchCacheOptions,
} from '@codesoul-co/hypha-memory';

// The complete export list is documented below.

Usage patterns

  • Use the 12 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 3 classes as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
  • The module exposes 3 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.
  • The 2 constant/enum exports provide stable values, schemas, definitions, or defaults. Reuse these exports instead of copying internal values into an application.

Runtime validation example

ts
import { managedMemorySearchResultSchema } from '@codesoul-co/hypha-memory';

declare function loadExternalInput(): unknown;
const input: unknown = loadExternalInput();
const parsed = managedMemorySearchResultSchema.parse(input);

Parse untrusted configuration, network, or persisted input with the runtime schema before passing it to functions or classes that expect a validated contract.

Public exports

SymbolKindSignatureDescription
CachedMemoryManagementProviderclassnew CachedMemoryManagementProvider(options: CachedMemoryManagementProviderOptions): CachedMemoryManagementProviderManaged-memory read-through cache. Mutations always execute against the provider first and then invalidate the exact scope. Access-stat searches are never cached because a hit would skip their intended write side effect.
InMemoryMemorySearchCacheStoreclassnew InMemoryMemorySearchCacheStore(options?: InMemoryMemorySearchCacheOptions): InMemoryMemorySearchCacheStoreIn Memory Memory Search Cache Store class with 8 public constructor or member entries; its exact declarations are listed below.
RedisMemorySearchCacheStoreclassnew RedisMemorySearchCacheStore(options: RedisMemorySearchCacheOptions): RedisMemorySearchCacheStoreShared Store for local, self-hosted, or managed Redis-compatible deployments.
managedMemorySearchResultSchemaconstantconst managedMemorySearchResultSchema: z.ZodObject<{ record: z.ZodEffects<z.ZodObject<{ id: z.ZodString; versionId: z.ZodString; revision: z.ZodNumber; type: z.ZodEnum<["working", "episodic", "semantic", "procedural", "preference", "artifact", "governance", "reflection", "custom"]>; subtype: z.ZodOptional<z.ZodString>; content: z.ZodUnknown; canonicalText: z.ZodOptional<z.ZodString>; summary: z.ZodOptional<z.ZodSt...Runtime schema for Managed Memory Search Result.
memorySearchCacheRecordSchemaconstantconst memorySearchCacheRecordSchema: z.ZodEffects<z.ZodObject<{ schemaVersion: z.ZodLiteral<"1.0">; keyVersion: z.ZodLiteral<"1">; key: z.ZodString; scopeHash: z.ZodString; scopeRevision: z.ZodString; requestHash: z.ZodString; profileRevision: z.ZodString; providerRevision: z.ZodString; results: z.ZodArray<z.ZodObject<{ record: z.ZodEffects<z.ZodObject<{ id: z.ZodString; versionId: z.ZodString; revision: z.ZodNumb...Runtime schema for Memory Search Cache Record.
composeMemorySearchCacheProviderfunctioncomposeMemorySearchCacheProvider(options: MemorySearchCacheCompositionOptions): MemoryManagementProviderExplicit product-composition boundary for Search Cache mode. Disabled mode returns the canonical provider without opening or consulting a Cache Store.
validateManagedMemorySearchResultsfunctionvalidateManagedMemorySearchResults(input: unknown): ManagedMemorySearchResult[]Validate Managed Memory Search Results function with 1 public call signature; parameters and return types are listed below.
validateMemorySearchCacheRecordfunctionvalidateMemorySearchCacheRecord(input: unknown, maxEntryBytes?: number): MemorySearchCacheRecordValidate Memory Search Cache Record function with 1 public call signature; parameters and return types are listed below.
CachedMemoryManagementProviderOptionsinterfaceinterface CachedMemoryManagementProviderOptionsCached Memory Management Provider Options interface with 14 public fields or methods.
InMemoryMemorySearchCacheOptionsinterfaceinterface InMemoryMemorySearchCacheOptionsIn Memory Memory Search Cache Options interface with 2 public fields or methods.
MemorySearchCacheAuthorizationDecisioninterfaceinterface MemorySearchCacheAuthorizationDecisionMemory Search Cache Authorization Decision interface with 4 public fields or methods.
MemorySearchCacheAuthorizationPortinterfaceinterface MemorySearchCacheAuthorizationPortMemory Search Cache Authorization Port interface with 1 public fields or methods.
MemorySearchCacheEventinterfaceinterface MemorySearchCacheEventMemory Search Cache Event interface with 6 public fields or methods.
MemorySearchCacheStoreinterfaceinterface MemorySearchCacheStoreMemory Search Cache Store interface with 7 public fields or methods.
RedisLikeMemorySearchCacheClientinterfaceinterface RedisLikeMemorySearchCacheClientRedis Like Memory Search Cache Client interface with 8 public fields or methods.
RedisMemorySearchCacheOptionsinterfaceinterface RedisMemorySearchCacheOptionsRedis Memory Search Cache Options interface with 4 public fields or methods.
MemorySearchCacheCompositionOptionstypetype MemorySearchCacheCompositionOptions = { mode: 'disabled'; provider: MemoryManagementProvider; } | (CachedMemoryManagementProviderOptions & { mode: 'enabled'; })Public type alias for Memory Search Cache Composition Options; the declaration contains its complete type expression.
MemorySearchCacheFailureModetypetype MemorySearchCacheFailureMode = 'bypass' | 'strict'Public type alias for Memory Search Cache Failure Mode; the declaration contains its complete type expression.
MemorySearchCacheModetypetype MemorySearchCacheMode = 'enabled' | 'disabled'Public type alias for Memory Search Cache Mode; the declaration contains its complete type expression.
MemorySearchCacheRecordtypetype MemorySearchCacheRecord = z.infer<typeof memorySearchCacheRecordSchema>Public type alias for Memory Search Cache Record; the declaration contains its complete type expression.

CachedMemoryManagementProvider

Managed-memory read-through cache. Mutations always execute against the provider first and then invalidate the exact scope. Access-stat searches are never cached because a hit would skip their intended write side effect.

  • Kind: class
  • Import: import { CachedMemoryManagementProvider } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export declare class CachedMemoryManagementProvider implements MemoryManagementProvider {
    readonly id: string;
    constructor(options: CachedMemoryManagementProviderOptions);
    capabilities(): Promise<import("./contracts").MemoryManagementCapabilities>;
    add(request: MemoryAddRequest): Promise<ManagedMemoryWriteResult>;
    search(rawRequest: ManagedMemorySearchRequest): Promise<ManagedMemorySearchResult[]>;
    get(request: MemoryGetRequest): Promise<import("./contracts").ManagedMemoryRecord<unknown> | null>;
    list(request: MemoryListRequest): Promise<MemoryListResult>;
    update(request: ManagedMemoryUpdateRequest): Promise<ManagedMemoryWriteResult>;
    delete(request: ManagedMemoryDeleteRequest): Promise<ManagedMemoryDeleteResult>;
    history(request: MemoryHistoryRequest): Promise<MemoryVersion[]>;
    health(): Promise<ProviderHealth>;
    close(): Promise<void>;
}

Public members

MemberKindSignatureDescription
addmethodadd(request: MemoryAddRequest): Promise<ManagedMemoryWriteResult>Public method; parameters and return type are shown in the signature.
capabilitiesmethodcapabilities(): Promise<import("./contracts").MemoryManagementCapabilities>Public method; parameters and return type are shown in the signature.
closemethodclose(): Promise<void>Public method; parameters and return type are shown in the signature.
constructorconstructor(options: CachedMemoryManagementProviderOptions): CachedMemoryManagementProviderCreates an instance of this class.
deletemethoddelete(request: ManagedMemoryDeleteRequest): Promise<ManagedMemoryDeleteResult>Public method; parameters and return type are shown in the signature.
getmethodget(request: MemoryGetRequest): Promise<import("./contracts").ManagedMemoryRecord<unknown> | null>Public method; parameters and return type are shown in the signature.
healthmethodhealth(): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
historymethodhistory(request: MemoryHistoryRequest): Promise<MemoryVersion[]>Public method; parameters and return type are shown in the signature.
idpropertyreadonly id: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
listmethodlist(request: MemoryListRequest): Promise<MemoryListResult>Public method; parameters and return type are shown in the signature.
searchmethodsearch(rawRequest: ManagedMemorySearchRequest): Promise<ManagedMemorySearchResult[]>Public method; parameters and return type are shown in the signature.
updatemethodupdate(request: ManagedMemoryUpdateRequest): Promise<ManagedMemoryWriteResult>Public method; parameters and return type are shown in the signature.

InMemoryMemorySearchCacheStore

In Memory Memory Search Cache Store class with 8 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { InMemoryMemorySearchCacheStore } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export declare class InMemoryMemorySearchCacheStore implements MemorySearchCacheStore {
    constructor(options?: InMemoryMemorySearchCacheOptions);
    getScopeRevision(scopeHash: string): Promise<string>;
    get(key: string): Promise<MemorySearchCacheRecord | null>;
    set(key: string, rawRecord: MemorySearchCacheRecord): Promise<void>;
    delete(key: string): Promise<void>;
    invalidateScope(scopeHash: string): Promise<number>;
    clear(): Promise<void>;
    stats(): {
            entries: number;
            sizeBytes: number;
            evictions: number;
        };
}

Public members

MemberKindSignatureDescription
clearmethodclear(): Promise<void>Public method; parameters and return type are shown in the signature.
constructorconstructor(options?: InMemoryMemorySearchCacheOptions): InMemoryMemorySearchCacheStoreCreates an instance of this class.
deletemethoddelete(key: string): Promise<void>Public method; parameters and return type are shown in the signature.
getmethodget(key: string): Promise<MemorySearchCacheRecord | null>Public method; parameters and return type are shown in the signature.
getScopeRevisionmethodgetScopeRevision(scopeHash: string): Promise<string>Public method; parameters and return type are shown in the signature.
invalidateScopemethodinvalidateScope(scopeHash: string): Promise<number>Public method; parameters and return type are shown in the signature.
setmethodset(key: string, rawRecord: MemorySearchCacheRecord): Promise<void>Public method; parameters and return type are shown in the signature.
statsmethodstats(): { entries: number; sizeBytes: number; evictions: number; }Public method; parameters and return type are shown in the signature.

RedisMemorySearchCacheStore

Shared Store for local, self-hosted, or managed Redis-compatible deployments.

  • Kind: class
  • Import: import { RedisMemorySearchCacheStore } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export declare class RedisMemorySearchCacheStore implements MemorySearchCacheStore {
    constructor(options: RedisMemorySearchCacheOptions);
    getScopeRevision(scopeHash: string): Promise<string>;
    get(key: string): Promise<MemorySearchCacheRecord | null>;
    set(key: string, input: MemorySearchCacheRecord): Promise<void>;
    delete(key: string): Promise<void>;
    invalidateScope(scopeHash: string): Promise<number>;
}

Public members

MemberKindSignatureDescription
constructorconstructor(options: RedisMemorySearchCacheOptions): RedisMemorySearchCacheStoreCreates an instance of this class.
deletemethoddelete(key: string): Promise<void>Public method; parameters and return type are shown in the signature.
getmethodget(key: string): Promise<MemorySearchCacheRecord | null>Public method; parameters and return type are shown in the signature.
getScopeRevisionmethodgetScopeRevision(scopeHash: string): Promise<string>Public method; parameters and return type are shown in the signature.
invalidateScopemethodinvalidateScope(scopeHash: string): Promise<number>Public method; parameters and return type are shown in the signature.
setmethodset(key: string, input: MemorySearchCacheRecord): Promise<void>Public method; parameters and return type are shown in the signature.

managedMemorySearchResultSchema

Runtime schema for Managed Memory Search Result.

  • Kind: constant
  • Import: import { managedMemorySearchResultSchema } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
// Exact type resolved from the package entrypoint; see source for the compiler expansion.
export declare const managedMemorySearchResultSchema: (typeof import('@codesoul-co/hypha-memory'))['managedMemorySearchResultSchema'];

This compiler-expanded constant type is compacted. Its public name, top-level type, and source location remain here; use the module’s exported interfaces, types, or runtime schema for input/output fields.

memorySearchCacheRecordSchema

Runtime schema for Memory Search Cache Record.

  • Kind: constant
  • Import: import { memorySearchCacheRecordSchema } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
// Exact type resolved from the package entrypoint; see source for the compiler expansion.
export declare const memorySearchCacheRecordSchema: (typeof import('@codesoul-co/hypha-memory'))['memorySearchCacheRecordSchema'];

This compiler-expanded constant type is compacted. Its public name, top-level type, and source location remain here; use the module’s exported interfaces, types, or runtime schema for input/output fields.

composeMemorySearchCacheProvider

Explicit product-composition boundary for Search Cache mode. Disabled mode returns the canonical provider without opening or consulting a Cache Store.

  • Kind: function
  • Import: import { composeMemorySearchCacheProvider } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export declare function composeMemorySearchCacheProvider(options: MemorySearchCacheCompositionOptions): MemoryManagementProvider;

Call signature

text
composeMemorySearchCacheProvider(options: MemorySearchCacheCompositionOptions): MemoryManagementProvider

Explicit product-composition boundary for Search Cache mode. Disabled mode returns the canonical provider without opening or consulting a Cache Store.

Parameters

ParameterTypeRequiredDescription
optionsMemorySearchCacheCompositionOptionsYesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: MemoryManagementProvider
  • Description: The return contract is defined by the type shown above.

validateManagedMemorySearchResults

Validate Managed Memory Search Results function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { validateManagedMemorySearchResults } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export declare function validateManagedMemorySearchResults(input: unknown): ManagedMemorySearchResult[];

Call signature

text
validateManagedMemorySearchResults(input: unknown): ManagedMemorySearchResult[]

Parameters

ParameterTypeRequiredDescription
inputunknownYesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: ManagedMemorySearchResult[]
  • Description: The return contract is defined by the type shown above.

validateMemorySearchCacheRecord

Validate Memory Search Cache Record function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { validateMemorySearchCacheRecord } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export declare function validateMemorySearchCacheRecord(input: unknown, maxEntryBytes?: number): MemorySearchCacheRecord;

Call signature

text
validateMemorySearchCacheRecord(input: unknown, maxEntryBytes?: number): MemorySearchCacheRecord

Parameters

ParameterTypeRequiredDescription
inputunknownYesRequired parameter; accepted values are defined by the type column.
maxEntryBytesnumberNoOptional parameter; accepted values are defined by the type column.

Returns

  • Type: { createdAt: number; scopeHash: string; expiresAt: number; providerRevision: string; profileRevision: string; key: string; schemaVersion: "1.0"; keyVersion: "1"; scopeRevision: string; requestHash: string; results: { record: { id: string; type: "working" | "episodic" | "semantic" | "procedural" | "artifact" | "governance" | "custom" | "preference" | "reflection"; status: "pending" | "failed" | "deleted" | "active" | "dormant" | "superseded" | "invalidated" | "deletion_pending"; createdAt: string; updatedAt: string; revision: number; scopeHash: string; scope: { userId: string; workspaceId?: string | undefined; sessionId?: string | undefined; runId?: string | undefined; tenantId?: string | undefined; projectId?: string | undefined; agentId?: string | undefined; domainPackId?: string | undefined; }; source: { type: "artifact" | "human_review" | "user_message" | "assistant_message" | "tool_result" | "workflow_state" | "import" | "derived" | "system"; sourceId?: string | undefined; sourceEventId?: string | undefined; sourceRunId?: string | undefined; sourceMessageId?: string | undefined; sourceArtifactId?: string | undefined; }; visibility: "workspace" | "private" | "session" | "tenant" | "shared"; provenance: { createdAt: string; providerId: string; createdBy: string; metadata?: Record<string, unknown> | undefined; extractorVersion?: string | undefined; sourceEventIds?: string[] | undefined; sourceMemoryIds?: string[] | undefined; transformation?: string | undefined; humanDecisionId?: string | undefined; }; versionId: string; contentHash: string; accessCount: number; indexStatus: { state: "none" | "pending" | "failed" | "deleted" | "partial" | "indexing" | "indexed"; attempts: number; lastError?: import("./contracts").NormalizedMemoryError | undefined; lastAttemptAt?: string | undefined; }; tags?: string[] | undefined; metadata?: Record<string, unknown> | undefined; expiresAt?: string | undefined; confidence?: number | undefined; entities?: { entityId: string; type?: string | undefined; confidence?: number | undefined; label?: string | undefined; }[] | undefined; canonicalText?: string | undefined; content?: unknown; importance?: number | undefined; subtype?: string | undefined; summary?: string | undefined; language?: string | undefined; strength?: number | undefined; salience?: number | undefined; lastAccessedAt?: string | undefined; lastReinforcedAt?: string | undefined; decayScore?: number | undefined; immutable?: boolean | undefined; humanVerified?: boolean | undefined; sensitive?: boolean | undefined; relations?: { type: "supersedes" | "supports" | "contradicts" | "derived_from" | "related_to" | "same_as" | "part_of"; targetMemoryId: string; metadata?: Record<string, unknown> | undefined; confidence?: number | undefined; }[] | undefined; vectorRefs?: { vectorStoreId: string; indexName: string; vectorId: string; embeddingProviderId: string; embeddingModel: string; indexedAt: string; embeddingRevision?: string | undefined; dimensions?: number | undefined; }[] | undefined; artifactRefs?: string[] | undefined; deletedAt?: string | undefined; }; score?: number | undefined; semanticScore?: number | undefined; keywordScore?: number | undefined; graphScore?: number | undefined; rerankScore?: number | undefined; reasons?: string[] | undefined; }[]; selectedMemoryVersionIds: string[]; sizeBytes?: number | undefined; }
  • Description: The return contract is defined by the type shown above.

CachedMemoryManagementProviderOptions

Cached Memory Management Provider Options interface with 14 public fields or methods.

  • Kind: interface
  • Import: import type { CachedMemoryManagementProviderOptions } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export interface CachedMemoryManagementProviderOptions {
    provider: MemoryManagementProvider;
    cache: MemorySearchCacheStore;
    providerRevision: string;
    failureMode?: MemorySearchCacheFailureMode;
    operationTimeoutMs?: number;
    ttlMs?: number;
    maxEntryBytes?: number;
    singleflight?: boolean;
    maxScopeRevisionRetries?: number;
    requiredScopeFields?: readonly (keyof ManagedMemoryScope)[];
    cacheAuthorization?: MemorySearchCacheAuthorizationPort;
    requireCacheAuthorization?: boolean;
    now?: () => number;
    trace?: (event: MemorySearchCacheEvent) => Promise<void> | void;
}

Contract members

MemberKindSignatureDescription
cachepropertycache: MemorySearchCacheStorePublic property; its type, readonly modifier and optionality are shown in the signature.
cacheAuthorizationpropertycacheAuthorization?: MemorySearchCacheAuthorizationPortPublic property; its type, readonly modifier and optionality are shown in the signature.
failureModepropertyfailureMode?: MemorySearchCacheFailureModePublic property; its type, readonly modifier and optionality are shown in the signature.
maxEntryBytespropertymaxEntryBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxScopeRevisionRetriespropertymaxScopeRevisionRetries?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
nowmethodnow?(): numberPublic method; parameters and return type are shown in the signature.
operationTimeoutMspropertyoperationTimeoutMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
providerpropertyprovider: MemoryManagementProviderPublic property; its type, readonly modifier and optionality are shown in the signature.
providerRevisionpropertyproviderRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
requireCacheAuthorizationpropertyrequireCacheAuthorization?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
requiredScopeFieldspropertyrequiredScopeFields?: readonly (keyof ManagedMemoryScope)[]Public property; its type, readonly modifier and optionality are shown in the signature.
singleflightpropertysingleflight?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
tracemethodtrace?(event: MemorySearchCacheEvent): Promise<void> | voidPublic method; parameters and return type are shown in the signature.
ttlMspropertyttlMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

InMemoryMemorySearchCacheOptions

In Memory Memory Search Cache Options interface with 2 public fields or methods.

  • Kind: interface
  • Import: import type { InMemoryMemorySearchCacheOptions } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export interface InMemoryMemorySearchCacheOptions {
    maxEntries?: number;
    maxBytes?: number;
}

Contract members

MemberKindSignatureDescription
maxBytespropertymaxBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxEntriespropertymaxEntries?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

MemorySearchCacheAuthorizationDecision

Memory Search Cache Authorization Decision interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { MemorySearchCacheAuthorizationDecision } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export interface MemorySearchCacheAuthorizationDecision {
    allowed: boolean;
    policyRevision: string;
    expiresAt?: string;
    reason?: string;
}

Contract members

MemberKindSignatureDescription
allowedpropertyallowed: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
expiresAtpropertyexpiresAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
policyRevisionpropertypolicyRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

MemorySearchCacheAuthorizationPort

Memory Search Cache Authorization Port interface with 1 public fields or methods.

  • Kind: interface
  • Import: import type { MemorySearchCacheAuthorizationPort } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export interface MemorySearchCacheAuthorizationPort {
    authorize(request: ManagedMemorySearchRequest): Promise<MemorySearchCacheAuthorizationDecision>;
}

Contract members

MemberKindSignatureDescription
authorizemethodauthorize(request: ManagedMemorySearchRequest): Promise<MemorySearchCacheAuthorizationDecision>Public method; parameters and return type are shown in the signature.

MemorySearchCacheEvent

Memory Search Cache Event interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { MemorySearchCacheEvent } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export interface MemorySearchCacheEvent {
    type: 'memory.cache.lookup' | 'memory.cache.hit' | 'memory.cache.miss' | 'memory.cache.write' | 'memory.cache.invalidate' | 'memory.cache.bypass';
    providerId: string;
    scopeHash: string;
    key?: string;
    reason?: 'not_found' | 'expired' | 'corrupt' | 'scope_mismatch' | 'revision_changed' | 'access_stats_requested' | 'profile_revision_missing' | 'scope_incomplete' | 'invalidation_pending' | 'entry_oversized' | 'store_unavailable';
    ageMs?: number;
}

Contract members

MemberKindSignatureDescription
ageMspropertyageMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
keypropertykey?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerIdpropertyproviderId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason?: "not_found" | "expired" | "scope_mismatch" | "store_unavailable" | "entry_oversized" | "corrupt" | "revision_changed" | "access_stats_requested" | "profile_revision_missing" | "scope_incomplete" | "invalidation_pending"Public property; its type, readonly modifier and optionality are shown in the signature.
scopeHashpropertyscopeHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
typepropertytype: "memory.cache.lookup" | "memory.cache.hit" | "memory.cache.miss" | "memory.cache.write" | "memory.cache.invalidate" | "memory.cache.bypass"Public property; its type, readonly modifier and optionality are shown in the signature.

MemorySearchCacheStore

Memory Search Cache Store interface with 7 public fields or methods.

  • Kind: interface
  • Import: import type { MemorySearchCacheStore } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export interface MemorySearchCacheStore {
    getScopeRevision(scopeHash: string): Promise<string>;
    get(key: string): Promise<MemorySearchCacheRecord | null>;
    set(key: string, record: MemorySearchCacheRecord): Promise<void>;
    delete(key: string): Promise<void>;
    invalidateScope(scopeHash: string): Promise<number>;
    clear?(): Promise<void>;
    close?(): Promise<void>;
}

Contract members

MemberKindSignatureDescription
clearmethodclear?(): Promise<void>Public method; parameters and return type are shown in the signature.
closemethodclose?(): Promise<void>Public method; parameters and return type are shown in the signature.
deletemethoddelete(key: string): Promise<void>Public method; parameters and return type are shown in the signature.
getmethodget(key: string): Promise<MemorySearchCacheRecord | null>Public method; parameters and return type are shown in the signature.
getScopeRevisionmethodgetScopeRevision(scopeHash: string): Promise<string>Public method; parameters and return type are shown in the signature.
invalidateScopemethodinvalidateScope(scopeHash: string): Promise<number>Public method; parameters and return type are shown in the signature.
setmethodset(key: string, record: MemorySearchCacheRecord): Promise<void>Public method; parameters and return type are shown in the signature.

RedisLikeMemorySearchCacheClient

Redis Like Memory Search Cache Client interface with 8 public fields or methods.

  • Kind: interface
  • Import: import type { RedisLikeMemorySearchCacheClient } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export interface RedisLikeMemorySearchCacheClient {
    get(key: string): Promise<string | null>;
    set(key: string, value: string, mode: 'PX', durationMilliseconds: number): Promise<unknown>;
    del(...keys: string[]): Promise<number>;
    sadd(key: string, ...members: string[]): Promise<number>;
    srem(key: string, ...members: string[]): Promise<number>;
    smembers(key: string): Promise<string[]>;
    incr(key: string): Promise<number>;
    pexpire(key: string, durationMilliseconds: number): Promise<number>;
}

Contract members

MemberKindSignatureDescription
delmethoddel(...keys: string[]): Promise<number>Public method; parameters and return type are shown in the signature.
getmethodget(key: string): Promise<string | null>Public method; parameters and return type are shown in the signature.
incrmethodincr(key: string): Promise<number>Public method; parameters and return type are shown in the signature.
pexpiremethodpexpire(key: string, durationMilliseconds: number): Promise<number>Public method; parameters and return type are shown in the signature.
saddmethodsadd(key: string, ...members: string[]): Promise<number>Public method; parameters and return type are shown in the signature.
setmethodset(key: string, value: string, mode: "PX", durationMilliseconds: number): Promise<unknown>Public method; parameters and return type are shown in the signature.
smembersmethodsmembers(key: string): Promise<string[]>Public method; parameters and return type are shown in the signature.
sremmethodsrem(key: string, ...members: string[]): Promise<number>Public method; parameters and return type are shown in the signature.

RedisMemorySearchCacheOptions

Redis Memory Search Cache Options interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { RedisMemorySearchCacheOptions } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export interface RedisMemorySearchCacheOptions {
    client: RedisLikeMemorySearchCacheClient;
    namespace?: string;
    maxEntryBytes?: number;
    now?: () => number;
}

Contract members

MemberKindSignatureDescription
clientpropertyclient: RedisLikeMemorySearchCacheClientPublic property; its type, readonly modifier and optionality are shown in the signature.
maxEntryBytespropertymaxEntryBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
namespacepropertynamespace?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
nowmethodnow?(): numberPublic method; parameters and return type are shown in the signature.

MemorySearchCacheCompositionOptions

Public type alias for Memory Search Cache Composition Options; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { MemorySearchCacheCompositionOptions } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export type MemorySearchCacheCompositionOptions = {
    mode: 'disabled';
    provider: MemoryManagementProvider;
} | (CachedMemoryManagementProviderOptions & {
    mode: 'enabled';
});

MemorySearchCacheFailureMode

Public type alias for Memory Search Cache Failure Mode; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { MemorySearchCacheFailureMode } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export type MemorySearchCacheFailureMode = 'bypass' | 'strict';

MemorySearchCacheMode

Public type alias for Memory Search Cache Mode; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { MemorySearchCacheMode } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export type MemorySearchCacheMode = 'enabled' | 'disabled';

MemorySearchCacheRecord

Public type alias for Memory Search Cache Record; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { MemorySearchCacheRecord } from '@codesoul-co/hypha-memory';
  • Source module: managed-search-cache

Declaration

text
export type MemorySearchCacheRecord = z.infer<typeof memorySearchCacheRecordSchema>;