/** * Caching for skills HTTP endpoints. * * Provides a cache abstraction for skill HTTP responses to reduce * latency and CPU overhead for repeated requests. * * Supports: * - Memory cache (default, single-instance) * - Redis cache (distributed, multi-instance) * * @module skill/cache/skill-http-cache */ import type { SkillMetadata } from '../../common/metadata'; /** * Cache interface for skills HTTP endpoints. */ export interface SkillHttpCache { /** Cache type identifier */ readonly type: 'memory' | 'redis'; /** * Get cached /llm.txt content. * @returns Cached content or null if not cached/expired */ getLlmTxt(): Promise; /** * Set cached /llm.txt content. * @param content - Content to cache */ setLlmTxt(content: string): Promise; /** * Get cached /llm_full.txt content. * @returns Cached content or null if not cached/expired */ getLlmFullTxt(): Promise; /** * Set cached /llm_full.txt content. * @param content - Content to cache */ setLlmFullTxt(content: string): Promise; /** * Get cached skills list. * @param hash - Hash of filter parameters * @returns Cached skills or null if not cached/expired */ getSkillsList(hash: string): Promise; /** * Set cached skills list. * @param hash - Hash of filter parameters * @param skills - Skills to cache */ setSkillsList(hash: string, skills: SkillMetadata[]): Promise; /** * Get cached individual skill. * @param skillId - Skill identifier * @returns Cached skill data or null if not cached/expired */ getSkill(skillId: string): Promise; /** * Set cached individual skill. * @param skillId - Skill identifier * @param data - Skill data to cache */ setSkill(skillId: string, data: unknown): Promise; /** * Invalidate all cached data. */ invalidateAll(): Promise; /** * Invalidate cached data for a specific skill. * @param skillId - Skill identifier */ invalidateSkill(skillId: string): Promise; /** * Dispose of cache resources. */ dispose(): Promise; } /** * In-memory implementation of SkillHttpCache. * * Suitable for single-instance deployments. * Data is lost on process restart. */ export declare class MemorySkillHttpCache implements SkillHttpCache { readonly type: "memory"; private readonly cache; private readonly ttlMs; constructor(ttlMs?: number); getLlmTxt(): Promise; setLlmTxt(content: string): Promise; getLlmFullTxt(): Promise; setLlmFullTxt(content: string): Promise; getSkillsList(hash: string): Promise; setSkillsList(hash: string, skills: SkillMetadata[]): Promise; getSkill(skillId: string): Promise; setSkill(skillId: string, data: unknown): Promise; invalidateAll(): Promise; invalidateSkill(skillId: string): Promise; dispose(): Promise; private get; private set; } /** * Redis implementation of SkillHttpCache. * * Suitable for distributed/multi-instance deployments. * Persists across process restarts (within TTL). */ export declare class RedisSkillHttpCache implements SkillHttpCache { readonly type: "redis"; private readonly keyPrefix; private readonly ttlMs; private readonly getClient; constructor(options: { getClient: () => Promise; keyPrefix?: string; ttlMs?: number; }); getLlmTxt(): Promise; setLlmTxt(content: string): Promise; getLlmFullTxt(): Promise; setLlmFullTxt(content: string): Promise; getSkillsList(hash: string): Promise; setSkillsList(hash: string, skills: SkillMetadata[]): Promise; getSkill(skillId: string): Promise; setSkill(skillId: string, data: unknown): Promise; invalidateAll(): Promise; invalidateSkill(skillId: string): Promise; dispose(): Promise; private get; private set; } /** * Minimal Redis client interface used by the cache. * Compatible with ioredis and @vercel/kv. */ interface RedisClient { get(key: string): Promise; setex(key: string, seconds: number, value: string): Promise; del(...keys: string[]): Promise; keys(pattern: string): Promise; } export {}; //# sourceMappingURL=skill-http-cache.d.ts.map