Skip to content

@codesoul-co/hypha-serving-cache / stores/memory-store

Using this module

Use the Memory store module for persisting and reading data at this boundary. It exports 2 classes.

Import from the package entrypoint

ts
import {
  MemoryCacheStore,
  NoopCacheStore,
} from '@codesoul-co/hypha-serving-cache';

Usage patterns

  • The module exposes 2 classes as constructable runtime implementations. Each symbol entry lists its constructor and public methods.

Public exports

SymbolKindSignatureDescription
MemoryCacheStoreclassnew MemoryCacheStore(options?: { maxEntries?: number; maxBytes?: number; }): MemoryCacheStoreMemory Cache Store class with 8 public constructor or member entries; its exact declarations are listed below.
NoopCacheStoreclassnew NoopCacheStore(): NoopCacheStoreNoop Cache Store class with 5 public constructor or member entries; its exact declarations are listed below.

MemoryCacheStore

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

  • Kind: class
  • Import: import { MemoryCacheStore } from '@codesoul-co/hypha-serving-cache';
  • Source module: stores/memory-store

Declaration

text
export declare class MemoryCacheStore implements CacheStore {
    constructor(options?: {
            maxEntries?: number;
            maxBytes?: number;
        });
    get<T>(key: string): Promise<CacheEntry<T> | null>;
    set<T>(key: string, entry: CacheEntry<T>): Promise<void>;
    delete(key: string): Promise<void>;
    clear(): Promise<void>;
    touch(key: string): Promise<void>;
    stats(): Promise<CacheStoreStats>;
    health(): Promise<CacheStoreHealth>;
}

Public members

MemberKindSignatureDescription
clearmethodclear(): Promise<void>Public method; parameters and return type are shown in the signature.
constructorconstructor(options?: { maxEntries?: number; maxBytes?: number; }): MemoryCacheStoreCreates an instance of this class.
deletemethoddelete(key: string): Promise<void>Public method; parameters and return type are shown in the signature.
getmethodget<T>(key: string): Promise<CacheEntry<T> | null>Public method; parameters and return type are shown in the signature.
healthmethodhealth(): Promise<CacheStoreHealth>Public method; parameters and return type are shown in the signature.
setmethodset<T>(key: string, entry: CacheEntry<T>): Promise<void>Public method; parameters and return type are shown in the signature.
statsmethodstats(): Promise<CacheStoreStats>Public method; parameters and return type are shown in the signature.
touchmethodtouch(key: string): Promise<void>Public method; parameters and return type are shown in the signature.

NoopCacheStore

Noop Cache Store class with 5 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { NoopCacheStore } from '@codesoul-co/hypha-serving-cache';
  • Source module: stores/memory-store

Declaration

text
export declare class NoopCacheStore implements CacheStore {
    get<T>(): Promise<CacheEntry<T> | null>;
    set<T>(): Promise<void>;
    delete(): Promise<void>;
    clear(): Promise<void>;
}

Public members

MemberKindSignatureDescription
clearmethodclear(): Promise<void>Public method; parameters and return type are shown in the signature.
constructorconstructor(): NoopCacheStoreCreates an instance of this class.
deletemethoddelete(): Promise<void>Public method; parameters and return type are shown in the signature.
getmethodget<T>(): Promise<CacheEntry<T> | null>Public method; parameters and return type are shown in the signature.
setmethodset<T>(): Promise<void>Public method; parameters and return type are shown in the signature.