node-redlock icon indicating copy to clipboard operation
node-redlock copied to clipboard

Support for 'redis' client

Open gregmartyn opened this issue 3 years ago • 5 comments

It looks like support for 'redis' was dropped from v5 in favor of exclusively supporting 'ioredis'. Is that something that might come back in the future?

Also: Is there an upgrading guide?

Here's what happens when trying to use redlock with redis from the 'redis' package (v3, provided by cache-manager-redis-store) instead of 'ioredis':

node_redis: The EVALSHA command contains a invalid argument type.
Only strings, dates and buffers are accepted. Please update your code to use valid argument types.
    at RedisClient.internal_send_command (/var/www/html/node_modules/cache-manager-redis-store/node_modules/redis/index.js:835:39)
    at RedisClient.evalsha (/var/www/html/node_modules/cache-manager-redis-store/node_modules/redis/lib/commands.js:46:25)
    at Redlock._attemptOperationOnClient (/var/www/html/node_modules/redlock/src/index.ts:555:41)
    at /var/www/html/node_modules/redlock/src/index.ts:482:16
    at new Promise (<anonymous>)
    at Redlock._attemptOperation (/var/www/html/node_modules/redlock/src/index.ts:478:18)
    at Redlock._execute (/var/www/html/node_modules/redlock/src/index.ts:439:42)
    at Redlock.acquire (/var/www/html/node_modules/redlock/src/index.ts:309:39)
    at Redlock.using (/var/www/html/node_modules/redlock/src/index.ts:738:27)
    at backgroundMutex (webpack-internal:///./src/server/complex-routes/session-cache/CustomerCache.js:323:21)

gregmartyn avatar Mar 30 '22 21:03 gregmartyn

I asked in https://github.com/mike-marcacci/node-redlock/pull/84#issuecomment-1032374391 as well. Supporting the closest thing to an official node client seems sensible. v4 can probably work in legacyMode: true (connect-redis does)

SimenB avatar Apr 05 '22 06:04 SimenB

Also intersted to know if we could get support for redis back.

DoobleD avatar Jun 07 '23 13:06 DoobleD

Interested in this as well. Do we have any explanation / improvement plan with regards to hardwiring to ioredis? Also, if v5 just doesn't work with it, from your experience, can I just use v4 and redis client and it would work reliably?

you-fail-me avatar Oct 06 '23 09:10 you-fail-me