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

Add hook.datastore.[lpush, lpushx, rpush, rpushx] #2

Open
christiangenco opened this issue Jan 7, 2016 · 2 comments
Open

Add hook.datastore.[lpush, lpushx, rpush, rpushx] #2

christiangenco opened this issue Jan 7, 2016 · 2 comments

Comments

@christiangenco
Copy link

hook.datastore.recent is timing out when I call it (I think "COUNT", 100 might be waiting for 100 matches to return?), but I'd still like a way to keep track of all of my keys.

My plan is to store them in a "keys" array. I could do this:

var key="foo", value="bar";
hook.datastore.get("keys", function(err, keys){
  keys = keys || [];
  keys.push(key);
  hook.datastore.set("keys", keys, function(err, result){
    hook.datastore.set(key, value, function(err, result){
      hook.res.end(result);
    })
  })
});

but it'd be easier/faster/more efficient for me to do this:

var key="foo", value="bar";
hook.datastore.lpush("keys", key, function(err, result){
  hook.datastore.set(key, value, function(err, result){
    hook.res.end(result);
  });
});
@Marak
Copy link
Member

Marak commented Mar 9, 2016

@christiangenco -

Thanks for the report. We are now looking to improve the datastore API.

First, recent should be working again. I had hot-patched this on the server a few weeks and just now backported the fix with 248c4ea

I'm thinking of just implementing datastore.all which would use SCAN to return all records which matched the users root name.

I'd like to try to keep the datastore api simple, but if we are going to hit performance issues, we should start thinking about optimizing for redis.

Let me know. A pull request would help.

@Marak
Copy link
Member

Marak commented Apr 16, 2016

CC @zanona

This might also solve the issue you are looking to address.

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