@codesoul-co/hypha-serving-cache / stores/redis-store
- Package index:
@codesoul-co/hypha-serving-cache - Source:
packages/serving-cache/src/stores/redis-store.ts - Exports: 3
Using this module
Use the Redis store module for persisting and reading data at this boundary. It exports 1 class, 2 interfaces.
Import from the package entrypoint
ts
import {
RedisCacheStore,
} from '@codesoul-co/hypha-serving-cache';
import type {
RedisCacheClient,
RedisCacheStoreOptions,
} from '@codesoul-co/hypha-serving-cache';Usage patterns
- Use the 2 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 1 class as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
RedisCacheStore | class | new RedisCacheStore(options: RedisCacheStoreOptions): RedisCacheStore | Redis Cache Store class with 7 public constructor or member entries; its exact declarations are listed below. |
RedisCacheClient | interface | interface RedisCacheClient | Redis Cache Client interface with 6 public fields or methods. |
RedisCacheStoreOptions | interface | interface RedisCacheStoreOptions | Redis Cache Store Options interface with 4 public fields or methods. |
RedisCacheStore
Redis Cache Store class with 7 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { RedisCacheStore } from '@codesoul-co/hypha-serving-cache'; - Source module:
stores/redis-store
Declaration
text
export declare class RedisCacheStore implements CacheStore {
constructor(options: RedisCacheStoreOptions);
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>;
health(): Promise<CacheStoreHealth>;
close(): Promise<void>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
clear | method | clear(): Promise<void> | Public method; parameters and return type are shown in the signature. |
close | method | close(): Promise<void> | Public method; parameters and return type are shown in the signature. |
constructor | constructor | (options: RedisCacheStoreOptions): RedisCacheStore | 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<T>(key: string): Promise<CacheEntry<T> | null> | Public method; parameters and return type are shown in the signature. |
health | method | health(): Promise<CacheStoreHealth> | Public method; parameters and return type are shown in the signature. |
set | method | set<T>(key: string, entry: CacheEntry<T>): Promise<void> | Public method; parameters and return type are shown in the signature. |
RedisCacheClient
Redis Cache Client interface with 6 public fields or methods.
- Kind: interface
- Import:
import type { RedisCacheClient } from '@codesoul-co/hypha-serving-cache'; - Source module:
stores/redis-store
Declaration
text
export interface RedisCacheClient {
get(key: string): Promise<string | null>;
set(key: string, value: string, ...args: Array<string | number>): Promise<unknown>;
del(...keys: string[]): Promise<number>;
scan(cursor: string, ...args: Array<string | number>): Promise<[string, string[]]>;
ping?(): Promise<string>;
quit?(): Promise<unknown>;
}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. |
quit | method | quit?(): Promise<unknown> | Public method; parameters and return type are shown in the signature. |
scan | method | scan(cursor: string, ...args: Array<string | number>): Promise<[string, string[]]> | Public method; parameters and return type are shown in the signature. |
set | method | set(key: string, value: string, ...args: Array<string | number>): Promise<unknown> | Public method; parameters and return type are shown in the signature. |
RedisCacheStoreOptions
Redis Cache Store Options interface with 4 public fields or methods.
- Kind: interface
- Import:
import type { RedisCacheStoreOptions } from '@codesoul-co/hypha-serving-cache'; - Source module:
stores/redis-store
Declaration
text
export interface RedisCacheStoreOptions {
client: RedisCacheClient;
prefix?: string;
closeClient?: boolean;
now?: () => number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
client | property | client: RedisCacheClient | Public property; its type, readonly modifier and optionality are shown in the signature. |
closeClient | property | closeClient?: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
now | method | now?(): number | Public method; parameters and return type are shown in the signature. |
prefix | property | prefix?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
