@zlattice/lattice-js
Version:
Lattice blockchain TypeScript SDK with dual module support (CJS + ESM)
21 lines • 709 B
TypeScript
type CacheBackend = "memory" | "redis";
type CacheConfig = {
backend: CacheBackend;
redisUrl?: string;
defaultTtl?: number | string;
namespace?: string;
};
declare class CacheService {
private cache;
constructor(config: CacheConfig);
static memory(): CacheService;
static redis(redisUrl: string): CacheService;
set<V>(key: string, value: V, ttl?: number | string): Promise<void>;
get<V>(key: string): Promise<V | null>;
delete(key: string): Promise<void>;
exists(key: string): Promise<boolean>;
validate<V>(key: string, value: V): Promise<boolean>;
reset(): Promise<void>;
}
export { type CacheConfig, CacheService };
//# sourceMappingURL=cache.d.ts.map