Ezequiel Miranda
Ezequiel Miranda

Reputation: 345

Redis-Node library, and what data structure use?

I'm using redis-node lib (http://github.com/bnoguchi/redis-node), and the requirement is the following:

I've a numbered set of items [1,2,3] (this items cannot be repeated), and I need to POP/PUSH to another list by the quantity items requested, the first of the main list and push into the other list.

So, I'm think that a better alternative can be a sorted set, because the items cannot be the same, but I don't have a method to pop and add at the same time (this must be inside a transaction block), and I need to POP over the first items of the list/set, not random.

What's the best way to do?

Upvotes: 0

Views: 43

Answers (1)

Liviu Costea
Liviu Costea

Reputation: 3794

If you look to do something in an atomic way (not transactional) then you have support for lua scripts. Also the redis-node library looks unmaintained, last commit is over 5 years ago and redis has evolved a lot since then, so you don't have support for lua. Instead I see this looks like a good library to use: node_redis This library has the eval command support

Upvotes: 1

Related Questions