Closed wangyx233 closed 4 years ago
I reproduced this bug too.
+1
+1
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 7 days if no further activity occurs, but feel free to re-open a closed issue if needed.
This issue was left to die on the vine with an open PR, but it is critical to the functionality of key prefixing. The workaround is to include keyPrefix
one level up (on the object which is the second parameter to new Cluster
) but the type definitions will yell at you for trying to do that. So you end up having to do something like this:
new Cluster(nodes, clusterRetryStrategy: { this.clusterRetryStrategy,
redisOptions: {
maxRetriesPerRequest: 1,
keyPrefix: `${this.config.RedisNamespace}:`,
},
/**
* The entry below fixes a bug where the keyPrefix is totally ignored when used in cluster mode.
* The issue has an open PR: https://github.com/luin/ioredis/issues/1024
*/
keyPrefix: `${this.config.RedisNamespace}:`
} as any)
It would be great if this PR were merged and this was resolved.
Just installed ioredis this week, so using latest. I am still seeing this issue. Thankfully I found this issue and was able to use this workaround.
I also just noticed this issue. While the workaround does work, it's a bit tedious when using TypeScript, since keyPrefix
is technically not valid on that location.
Any chance this issue can be re-opened? To avoid the workaround and also to avoid future confusion for other people. :)
would be nice if the fix be ported to 4.x
Just encountered this issue using the old 4.x.x
version of IoRedis. It would be great to either backport this feature or remove keyPrefix from the TypeScript types for 4.x.x so people are not led to believe this feature is supported, when it isn't.
version: 4.14.1 According to doc, I think keyPrefix in redisOptions. But it doesn't work. Like blow:
After attempts, it actually works in root option, like this:
Is it by design?