Reputation: 5706
I have some keys in Redis <K,V>
where V is a comma separated string of sub strings V: <v1,v2,v3,...,vn>
.
Until now I was simply setting keys by using a transaction in Jedis (Redis API in Java). But a new requirement needs me to perform some operations on the existing keys. So I have two options:
Option 2 seems faster as it will save a round trip but I have the following considerations:
My Solution
Since as said by the answer below none of them are a feasible choice. I wrote my own Redis command in C and compiled the source. So now I will call
redis-cli> MyCommand K V
For each <K,V>
in pipeline. I followed the tutorial here - Hacking Redis. However it might not be adequate and require one to browse and understand some code by yourself!
Upvotes: 2
Views: 866
Reputation: 49942
wrt #1 - a Lua script is atomic but it does not provide this type of consistency assurance. In case a script fails, its updates will not be rolled back by Redis automatically. There is a proposal to improve this behavior but it is yet to be accepted into Redis (see Josiah Carlson's blog here: http://www.dr-josiah.com/2015/07/transactions-in-redis.html)
wrt #2 - I don't know if such a huge list will go smoothly or not but if you need it you're probably using it wrong ;)
Upvotes: 3