openai-caching-proxy-worker icon indicating copy to clipboard operation
openai-caching-proxy-worker copied to clipboard

feat: Add support for local Redis caching

Open cvaz1306 opened this issue 6 months ago • 0 comments

This change introduces the capability to use a local or self-hosted Redis instance for caching responses, in addition to the existing Upstash Redis and Cloudflare KV options.

Modifications include:

  • Updated src/env.ts to include LOCAL_REDIS_URL, LOCAL_REDIS_PORT, and LOCAL_REDIS_PASSWORD environment variable definitions.
  • Modified src/cache.ts to use ioredis for connecting to a local Redis instance. The caching preference order is now Upstash Redis, then Local Redis, then Cloudflare KV.
  • Added ioredis to package.json dependencies and @types/ioredis to devDependencies.
  • Updated wrangler.toml with instructions and examples for configuring local Redis via environment variables/secrets or .dev.vars.
  • Updated README.md to document the new local Redis feature, including configuration instructions and the cache priority order.

cvaz1306 avatar Jun 02 '25 01:06 cvaz1306