AxContextCacheRegistry
type AxContextCacheRegistry = object;
Defined in: https://github.com/ax-llm/ax/blob/a8847bd2906efff202fde10d776fddd20fd2ff57/src/ax/ai/types.ts#L488
External registry for persisting context cache metadata. Useful for serverless/short-lived processes where in-memory storage is lost.
Example
// Redis-backed registry
const registry: AxContextCacheRegistry = {
get: async (key) => {
const data = await redis.get(`cache:${key}`);
return data ? JSON.parse(data) : undefined;
},
set: async (key, entry) => {
await redis.set(`cache:${key}`, JSON.stringify(entry), 'EX', 3600);
},
};
Properties
get()
get: (key: string) =>
| Promise<
| AxContextCacheRegistryEntry
| undefined>
| AxContextCacheRegistryEntry
| undefined;
Defined in: https://github.com/ax-llm/ax/blob/a8847bd2906efff202fde10d776fddd20fd2ff57/src/ax/ai/types.ts#L490
Look up a cache entry by key
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
| Promise<
| AxContextCacheRegistryEntry
| undefined>
| AxContextCacheRegistryEntry
| undefined
set()
set: (key: string, entry: Readonly<AxContextCacheRegistryEntry>) => Promise<void> | void;
Defined in: https://github.com/ax-llm/ax/blob/a8847bd2906efff202fde10d776fddd20fd2ff57/src/ax/ai/types.ts#L497
Store a cache entry
Parameters
| Parameter | Type |
|---|---|
key | string |
entry | Readonly<AxContextCacheRegistryEntry> |
Returns
Promise<void> | void