Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@keyv/redis: useRedisSets option does not take effect when providing ioredis instance #902

Closed
jacksmith15 opened this issue Aug 29, 2023 · 1 comment
Labels

Comments

@jacksmith15
Copy link

Describe the bug

The useRedisSets option only takes effect when passing a Redis client as a URI, and does not take effect when passing a Redis client directly.

I believe this is because the useRedisSets option is set inside this code branch.

How To Reproduce (best to provide workable code or tests!)

import KeyvRedis from '@keyv/redis';
import { Redis } from 'ioredis';


const REDIS_IP = process.env.REDIS_IP;


const cacheFromInstance: KeyvRedis = new KeyvRedis(
  new Redis({
    host: REDIS_IP,
    port: 6379,
  }),
  { useRedisSets: false },
);

console.log(`Instance useRedisSets: ${cacheFromInstance.opts.useRedisSets}`);


const cacheFromURI: KeyvRedis = new KeyvRedis(
  `redis://${REDIS_IP}:6379`,
  { useRedisSets: false },
);

console.log(`URI useRedisSets: ${cacheFromURI.opts.useRedisSets}`);

When executing the above script with npm exec ts-node reproduce.ts:

Expected output

Instance useRedisSets: false
URI useRedisSets: false

Actual output

Instance useRedisSets: true
URI useRedisSets: false

@jaredwray
Copy link
Owner

@jacksmith15, @kaykdm, and @jawang35 - Thanks for bringing this to our attention. We have a fix and have added unit testing around this. Will be publishing the update today as v2.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants