Download packages/cache/src/api-key-cache.ts from AUXteam/Midday: direct link, hf CLI and curl.
- Browser
- Download file 481 Bytes
-
https://huggingface.co/spaces/AUXteam/Midday/resolve/main/packages/cache/src/api-key-cache.ts
- Command line
-
hf download hf://spaces/AUXteam/Midday/packages/cache/src/api-key-cache.ts
-
curl -L -o api-key-cache.ts https://huggingface.co/spaces/AUXteam/Midday/resolve/main/packages/cache/src/api-key-cache.ts
481 Bytes
| import type { ApiKey } from "@midday/db/queries"; | |
| import { RedisCache } from "./redis-client"; | |
| // Redis-based cache for API keys shared across all server instances | |
| const cache = new RedisCache("api-key", 30 * 60); // 30 minutes TTL | |
| export const apiKeyCache = { | |
| get: (key: string): Promise<ApiKey | undefined> => cache.get<ApiKey>(key), | |
| set: (key: string, value: ApiKey): Promise<void> => cache.set(key, value), | |
| delete: (key: string): Promise<void> => cache.delete(key), | |
| }; | |