mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-04-03 14:27:20 +02:00
🗃️ refactor: Separate Tool Cache Namespace for Blue/Green Deployments (#11738)
* 🔧 refactor: Introduce TOOL_CACHE for isolated caching of tools - Added TOOL_CACHE key to CacheKeys enum for managing tool-related cache. - Updated various services and controllers to utilize TOOL_CACHE instead of CONFIG_STORE for better separation of concerns in caching logic. - Enhanced .env.example with comments on using in-memory cache for blue/green deployments. * 🔧 refactor: Update cache configuration for in-memory storage handling - Enhanced the handling of `FORCED_IN_MEMORY_CACHE_NAMESPACES` in `cacheConfig.ts` to default to `CONFIG_STORE` and `APP_CONFIG`, ensuring safer blue/green deployments. - Updated `.env.example` with clearer comments regarding the usage of in-memory cache namespaces. - Improved unit tests to validate the new default behavior and handling of empty strings for cache namespaces.
This commit is contained in:
parent
c7531dd029
commit
5b67e48fe1
11 changed files with 284 additions and 18 deletions
11
packages/api/src/cache/cacheConfig.ts
vendored
11
packages/api/src/cache/cacheConfig.ts
vendored
|
|
@ -27,9 +27,14 @@ const USE_REDIS_STREAMS =
|
|||
|
||||
// Comma-separated list of cache namespaces that should be forced to use in-memory storage
|
||||
// even when Redis is enabled. This allows selective performance optimization for specific caches.
|
||||
const FORCED_IN_MEMORY_CACHE_NAMESPACES = process.env.FORCED_IN_MEMORY_CACHE_NAMESPACES
|
||||
? process.env.FORCED_IN_MEMORY_CACHE_NAMESPACES.split(',').map((key) => key.trim())
|
||||
: [];
|
||||
// Defaults to CONFIG_STORE,APP_CONFIG so YAML-derived config stays per-container.
|
||||
// Set to empty string to force all namespaces through Redis.
|
||||
const FORCED_IN_MEMORY_CACHE_NAMESPACES =
|
||||
process.env.FORCED_IN_MEMORY_CACHE_NAMESPACES !== undefined
|
||||
? process.env.FORCED_IN_MEMORY_CACHE_NAMESPACES.split(',')
|
||||
.map((key) => key.trim())
|
||||
.filter(Boolean)
|
||||
: [CacheKeys.CONFIG_STORE, CacheKeys.APP_CONFIG];
|
||||
|
||||
// Validate against CacheKeys enum
|
||||
if (FORCED_IN_MEMORY_CACHE_NAMESPACES.length > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue