Lua scripts in Redis within Node.js(techblog.s6.io)
techblog.s6.io
Lua scripts in Redis within Node.js
http://techblog.s6.io/blog/2014/09/18/lua-scripts-in-redis-within-nodejs.html
2 comments
Author here. Would love to here any feedback on the topic if anybody is doing anything similiar
Very interesting -- it seems redis is used more and more for of its data mangling capacity.
I have 2 questions, although I don't use redis in prod I'm interested in it:
- Why use key -> json ? There are a decode and an encode to be done on each operation. The naive way to do it would be hashes (http://redis.io/commands#hash) with the likes of HSET and HMSET, and a structure like 'a' -> 'spend' -> 3. which not only make operations faster but should also take less space thanks to memory optimization of similar keys in a hash.
- What do you do for persistance ? Which one did you choose ? Are you okay with the slight delay ? Or do you just make it all in-memory ?
I have 2 questions, although I don't use redis in prod I'm interested in it:
- Why use key -> json ? There are a decode and an encode to be done on each operation. The naive way to do it would be hashes (http://redis.io/commands#hash) with the likes of HSET and HMSET, and a structure like 'a' -> 'spend' -> 3. which not only make operations faster but should also take less space thanks to memory optimization of similar keys in a hash.
- What do you do for persistance ? Which one did you choose ? Are you okay with the slight delay ? Or do you just make it all in-memory ?
Sounds a bit like reinventing Stored Procedures for Redis to me :|