Question

I evaluate Redis.io for keeping clicks/logging stream (and then saving into one file or system, i.e. aggregating logs from many servers).

While adding to redis is simple SADD http://redis.io/commands#set or LPUSH http://redis.io/commands#list

(I need to choose Set or List to have messages from one logger grouped)

However, retrieving is done only one-by-one, e.g. LPOP.

I need one command to return all current value in a Set or List and delete them at once. If getting all and then deleting all with 2 commands, then there is risk that some entry was added in between time.

Maybe there is better solution for Event logging with distributed database for node.js (MongoDB?) with Redis.

Was it helpful?

Solution

For sets, try the SMEMBERS command: http://redis.io/commands/smembers After that, you may just delete the set.

Also you may need to execute these commands in the same "transaction", so the code would like

MULTI
SMEMBERS yourset
DEL yourset
EXEC
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top