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

keyPrefix in 'redis.keys' command #254

Closed
apostopher opened this issue Feb 11, 2016 · 2 comments
Closed

keyPrefix in 'redis.keys' command #254

apostopher opened this issue Feb 11, 2016 · 2 comments

Comments

@apostopher
Copy link

The following code snippet returns empty array for 'keys' command.

    const Redis = require('ioredis');
    const redis = new Redis({keyPrefix: 'foo:'}); // set the namespace
    redis.set('bar:baz', 1).then(()=> {
      return redis.keys('bar:*').then((keys)=>{
        console.log(keys); // output is []. shouldn't it be ["foo:bar:baz"] ?
      });
    }).catch((error)=> {
      console.log(error);
    });

It appears that redis.keys command does not add foo: namespace.

@apostopher apostopher changed the title keyPrefix does't work in 'redis.keys' command keyPrefix in 'redis.keys' command Feb 12, 2016
@luin
Copy link
Collaborator

luin commented Feb 12, 2016

Duplicate of #239.
The first argument of KEYS command is a pattern rather than key name, so we don't prefix it with keyPrefix.

@apostopher
Copy link
Author

ok. got it! closing this issue. thanks!

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

No branches or pull requests

2 participants