feat(cache): add Redis single-key operations support for ElastiCache Serverless #11269
+194
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
REDIS_SINGLE_KEY_OPSconfiguration option to support AWS ElastiCache Serverless (Valkey 8.1) which internally shards data but doesn't expose the Redis Cluster protocol.Problem
USE_REDIS_CLUSTER=falsecauses CROSSSLOT errors on batch operationsUSE_REDIS_CLUSTER=truefails withClusterAllFailedErrorbecause ElastiCache Serverless doesn't supportCLUSTER NODES/CLUSTER SLOTScommandsSolution
REDIS_SINGLE_KEY_OPSenv var forces single-key operations without requiring cluster clientUSE_REDIS_CLUSTER=false+REDIS_SINGLE_KEY_OPS=trueChange Type
Testing
USE_REDIS=true,USE_REDIS_CLUSTER=false,REDIS_SINGLE_KEY_OPS=truesingle-key-opsmode indicatorTechnical Details
Files Changed:
packages/api/src/cache/cacheConfig.ts- AddedREDIS_SINGLE_KEY_OPSconfigurationpackages/api/src/cache/redisUtils.ts- UpdatedbatchDeleteKeys()to respect new optionConfiguration:
# For AWS ElastiCache Serverless USE_REDIS=true USE_REDIS_CLUSTER=false REDIS_SINGLE_KEY_OPS=true REDIS_URI=rediss://your-elasticache-endpoint:6379