Skip to content

Commit 17cf837

Browse files
authored
feat(11528): add Redis 5.x support with backward compatibility wite peer dependency to allow (#11585)
* feat: add Redis 5 support to cache implementation - Add version detection for Redis client to handle API differences - Support Redis 5 Promise-based API while maintaining backward compatibility - Update methods to use appropriate API based on Redis version - Add tests for Redis 5 compatibility Redis 5 introduced Promise-based API as default, replacing the callback-based API. This change detects the Redis version and uses the appropriate API calls to ensure compatibility with Redis 3, 4, and 5. Closes #11528 * feat: add Redis 5 support to cache implementation Implement automatic version detection for Redis client libraries to support Redis 3, 4, and 5 seamlessly. The implementation uses runtime API testing to determine the appropriate Redis client behavior without breaking existing functionality. Changes include: - Dynamic Redis version detection based on client API characteristics - Promise-based API support for Redis 5.x - Backward compatibility with Redis 3.x and 4.x callback-based APIs - Safe fallback mechanism defaulting to Redis 3 behavior - Updated peer dependency to include Redis 5.x versions The cache implementation now automatically adapts to the installed Redis version, ensuring optimal performance and compatibility across all supported Redis client versions while maintaining full backward compatibility. * fix: delete wrong migration guide * feat: add package-lock.json * refactor: optimize Redis client creation to reduce memory usage Eliminate unnecessary Redis client recreation by using explicit tempClient variable management, reducing potential client instances while maintaining full Redis 3/4/5 compatibility and accurate version detection. * refactor: improve Redis version detection to avoid cache pollution Replace test key creation method with client method signature analysis to prevent potential cache pollution and improve performance. * style: apply Prettier formatting to RedisQueryResultCache.ts
1 parent 8097d1a commit 17cf837

File tree

3 files changed

+175
-98
lines changed

3 files changed

+175
-98
lines changed

package-lock.json

Lines changed: 48 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
"pg-query-stream": "^4.8.1",
150150
"pkg-pr-new": "^0.0.43",
151151
"prettier": "^2.8.8",
152-
"redis": "^4.7.0",
152+
"redis": "^5.7.0",
153153
"reflect-metadata": "^0.2.2",
154154
"remap-istanbul": "^0.13.0",
155155
"rimraf": "^5.0.10",
@@ -176,7 +176,7 @@
176176
"pg": "^8.5.1",
177177
"pg-native": "^3.0.0",
178178
"pg-query-stream": "^4.0.0",
179-
"redis": "^3.1.1 || ^4.0.0",
179+
"redis": "^3.1.1 || ^4.0.0 || ^5.0.14",
180180
"reflect-metadata": "^0.1.14 || ^0.2.0",
181181
"sql.js": "^1.4.0",
182182
"sqlite3": "^5.0.3",

0 commit comments

Comments
 (0)