@codesoul-co/hypha-memory / context-cache-validity
- Package index:
@codesoul-co/hypha-memory - Source:
packages/memory/src/context-cache-validity.ts - Exports: 7
Using this module
Use the Context cache validity module for reading, writing, or coordinating cache state. It exports 2 classes, 1 function, 4 interfaces.
Import from the package entrypoint
import {
InMemoryContextEnvelopeCacheStore,
VersionValidContextCache,
createContextCacheValidityHash,
} from '@codesoul-co/hypha-memory';
import type {
ContextCacheVersionSnapshot,
ContextEnvelopeCacheStore,
VersionValidContextCacheOptions,
VersionValidContextCacheRecord,
} 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.
- The module exposes 1 function as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
InMemoryContextEnvelopeCacheStore | class | new InMemoryContextEnvelopeCacheStore(): InMemoryContextEnvelopeCacheStore | In Memory Context Envelope Cache Store class with 5 public constructor or member entries; its exact declarations are listed below. |
VersionValidContextCache | class | new VersionValidContextCache(options: VersionValidContextCacheOptions): VersionValidContextCache | Version Valid Context Cache class with 5 public constructor or member entries; its exact declarations are listed below. |
createContextCacheValidityHash | function | createContextCacheValidityHash(snapshot: ContextCacheVersionSnapshot): string | Create Context Cache Validity Hash function with 1 public call signature; parameters and return types are listed below. |
ContextCacheVersionSnapshot | interface | interface ContextCacheVersionSnapshot | Context Cache Version Snapshot interface with 9 public fields or methods. |
ContextEnvelopeCacheStore | interface | interface ContextEnvelopeCacheStore | Context Envelope Cache Store interface with 4 public fields or methods. |
VersionValidContextCacheOptions | interface | interface VersionValidContextCacheOptions | Version Valid Context Cache Options interface with 5 public fields or methods. |
VersionValidContextCacheRecord | interface | interface VersionValidContextCacheRecord | Version Valid Context Cache Record interface with 7 public fields or methods. |
InMemoryContextEnvelopeCacheStore
In Memory Context Envelope Cache Store class with 5 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { InMemoryContextEnvelopeCacheStore } from '@codesoul-co/hypha-memory'; - Source module:
context-cache-validity
Declaration
export declare class InMemoryContextEnvelopeCacheStore implements ContextEnvelopeCacheStore {
get(key: string): Promise<VersionValidContextCacheRecord | null>;
set(key: string, value: VersionValidContextCacheRecord): Promise<void>;
delete(key: string): Promise<void>;
invalidateScope(scopeHash: string): Promise<number>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
constructor | constructor | (): InMemoryContextEnvelopeCacheStore | Creates an instance of this class. |
delete | method | delete(key: string): Promise<void> | Public method; parameters and return type are shown in the signature. |
get | method | get(key: string): Promise<VersionValidContextCacheRecord | null> | Public method; parameters and return type are shown in the signature. |
invalidateScope | method | invalidateScope(scopeHash: string): Promise<number> | Public method; parameters and return type are shown in the signature. |
set | method | set(key: string, value: VersionValidContextCacheRecord): Promise<void> | Public method; parameters and return type are shown in the signature. |
VersionValidContextCache
Version Valid Context Cache class with 5 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { VersionValidContextCache } from '@codesoul-co/hypha-memory'; - Source module:
context-cache-validity
Declaration
export declare class VersionValidContextCache implements MemoryProjectionInvalidationTarget {
readonly id: string;
constructor(options: VersionValidContextCacheOptions);
invalidateScope(scopeHash: string): Promise<number>;
get(key: string, current: ContextCacheVersionSnapshot): Promise<ContextEnvelope | null>;
set(key: string, envelope: ContextEnvelope, snapshot: ContextCacheVersionSnapshot, expiresAt?: string): Promise<void>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
constructor | constructor | (options: VersionValidContextCacheOptions): VersionValidContextCache | Creates an instance of this class. |
get | method | get(key: string, current: ContextCacheVersionSnapshot): Promise<ContextEnvelope | null> | Public method; parameters and return type are shown in the signature. |
id | property | readonly id: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
invalidateScope | method | invalidateScope(scopeHash: string): Promise<number> | Public method; parameters and return type are shown in the signature. |
set | method | set(key: string, envelope: ContextEnvelope, snapshot: ContextCacheVersionSnapshot, expiresAt?: string): Promise<void> | Public method; parameters and return type are shown in the signature. |
createContextCacheValidityHash
Create Context Cache Validity Hash function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { createContextCacheValidityHash } from '@codesoul-co/hypha-memory'; - Source module:
context-cache-validity
Declaration
export declare function createContextCacheValidityHash(snapshot: ContextCacheVersionSnapshot): string;Call signature
createContextCacheValidityHash(snapshot: ContextCacheVersionSnapshot): stringParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
snapshot | ContextCacheVersionSnapshot | Yes | Required parameter; accepted values are defined by the type column. |
Returns
- Type:
string - Description: The return contract is defined by the type shown above.
ContextCacheVersionSnapshot
Context Cache Version Snapshot interface with 9 public fields or methods.
- Kind: interface
- Import:
import type { ContextCacheVersionSnapshot } from '@codesoul-co/hypha-memory'; - Source module:
context-cache-validity
Declaration
export interface ContextCacheVersionSnapshot {
contextProfileRevision: string;
memoryProfileRevision: string;
scopeHash: string;
providerRevision?: string;
policyRevision?: string;
mutationGeneration: string;
selectedMemoryVersionIds: string[];
sourceHashes: Record<string, string>;
artifactHashes?: Record<string, string>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
artifactHashes | property | artifactHashes?: Record<string, string> | Public property; its type, readonly modifier and optionality are shown in the signature. |
contextProfileRevision | property | contextProfileRevision: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
memoryProfileRevision | property | memoryProfileRevision: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
mutationGeneration | property | mutationGeneration: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
policyRevision | property | policyRevision?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
providerRevision | property | providerRevision?: string | 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. |
selectedMemoryVersionIds | property | selectedMemoryVersionIds: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
sourceHashes | property | sourceHashes: Record<string, string> | Public property; its type, readonly modifier and optionality are shown in the signature. |
ContextEnvelopeCacheStore
Context Envelope Cache Store interface with 4 public fields or methods.
- Kind: interface
- Import:
import type { ContextEnvelopeCacheStore } from '@codesoul-co/hypha-memory'; - Source module:
context-cache-validity
Declaration
export interface ContextEnvelopeCacheStore {
get(key: string): Promise<VersionValidContextCacheRecord | null>;
set(key: string, value: VersionValidContextCacheRecord): Promise<void>;
delete(key: string): Promise<void>;
invalidateScope(scopeHash: string): Promise<number>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
delete | method | delete(key: string): Promise<void> | Public method; parameters and return type are shown in the signature. |
get | method | get(key: string): Promise<VersionValidContextCacheRecord | null> | Public method; parameters and return type are shown in the signature. |
invalidateScope | method | invalidateScope(scopeHash: string): Promise<number> | Public method; parameters and return type are shown in the signature. |
set | method | set(key: string, value: VersionValidContextCacheRecord): Promise<void> | Public method; parameters and return type are shown in the signature. |
VersionValidContextCacheOptions
Version Valid Context Cache Options interface with 5 public fields or methods.
- Kind: interface
- Import:
import type { VersionValidContextCacheOptions } from '@codesoul-co/hypha-memory'; - Source module:
context-cache-validity
Declaration
export interface VersionValidContextCacheOptions {
store: ContextEnvelopeCacheStore;
now?: () => string;
artifactStore?: ContextArtifactStore;
projectionId?: string;
generations?: MemoryMutationGenerationStore;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
artifactStore | property | artifactStore?: ContextArtifactStore | Public property; its type, readonly modifier and optionality are shown in the signature. |
generations | property | generations?: MemoryMutationGenerationStore | Public property; its type, readonly modifier and optionality are shown in the signature. |
now | method | now?(): string | Public method; parameters and return type are shown in the signature. |
projectionId | property | projectionId?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
store | property | store: ContextEnvelopeCacheStore | Public property; its type, readonly modifier and optionality are shown in the signature. |
VersionValidContextCacheRecord
Version Valid Context Cache Record interface with 7 public fields or methods.
- Kind: interface
- Import:
import type { VersionValidContextCacheRecord } from '@codesoul-co/hypha-memory'; - Source module:
context-cache-validity
Declaration
export interface VersionValidContextCacheRecord {
key: string;
envelope: ContextEnvelope;
snapshot: ContextCacheVersionSnapshot;
validityHash: string;
envelopeHash: string;
createdAt: string;
expiresAt?: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
createdAt | property | createdAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
envelope | property | envelope: ContextEnvelope | Public property; its type, readonly modifier and optionality are shown in the signature. |
envelopeHash | property | envelopeHash: 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. |
key | property | key: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
snapshot | property | snapshot: ContextCacheVersionSnapshot | Public property; its type, readonly modifier and optionality are shown in the signature. |
validityHash | property | validityHash: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
