Coder Social home page Coder Social logo

node-redis-scan's People

Contributors

soundslocke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

makerbot shakahl

node-redis-scan's Issues

Add support for limiting the scan

It would be useful in some contexts to have an option for limiting the scan. At times we only want to scan until returning the first matching key or the first n matching keys. This would lend itself to scan() as well as eachScan() (plus the specific variants of these).

Similar functionality could be achieved if the client is able to cancel any scan in progress though this approach would only lend itself to eachScan().

Using REST route to show scanned data.

Hey!

I'm trying to use the scanner.scan to make a route that shows all the keys of my redis, but the problem is that the scan does not populate my array even when I use the await before it.
Am I trying to use it wrong?

The code:

`public async getAll(): Promise< any > {
let allData: string[] = [];

let test = await scanner.scan('*', (err: any, match: string[]) => {
  if(err) throw(err);

  console.log(match); // This log returns the correct data but only after the route is already closed.
  return match;
});

console.log(test); // This log return an empty array.

return allData;

}`

Appreciate your help!

Can't get this package to work

async function scan() {
    const client = await getRedisClient();

    const redisScan = require("node-redis-scan");
    const scanner = new redisScan(client);

    scanner.scan("*", (err, matchingKeys) => {
        console.log("test");
    });
}

Doesn't output "test" at all. The redisclient is working fine in other methods.
Running scan 0 match * prints out all of the keys in redis.

Add support for Node Redis version 4.x clients

This would likely lead to a new 2.x release for this library which might not be backwards compatible with Node Redis clients of version 3.x. It would depend on whether there is a clean way to differentiate between client instance types. Something to look into.

I'm also not sure how useful this would be given Node Redis 4.x supports scan iterators now. One use might be in providing methods which return all of the gathered values at once, which would be less verbose/cumbersome than writing iterator loops every time you want to scan and could be preferable, given the context. ๐Ÿค”

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.