Custodian of the Book of Life (2016).
Lancelet anti-virus v9.6.1 crack [free] The technology of movies online are coming to an end.
Editor reviews:
Product: Grauonline Video Repair Activation Code Generator.
Editor's picks: Don't get involved in these.
All of the cracks, patches, keygens and serials are stored in a database which stores the.
Q:
Redis Lua simple script return in reverse order?
I have 2 key in redis.
1:test
2:123
Now I want to get the key and return in reverse order.
I am using simple lua script.
if #2 ~=0 then
return 2
end
if #1 ~=0 then
return 1
end
return 0
I am using this redis-cli and got result.
127.0.0.1:6379> set test 1
OK
127.0.0.1:6379> set test 2
OK
127.0.0.1:6379> lpush abc a
1) "abc"
2) "a"
127.0.0.1:6379> lrange abc 0 -1
1) "a"
2) "2"
127.0.0.1:6379> lrange abc 0 -1
1) "2"
2) "1"
It is showing all the records in reverse order.
but, in lua script I am checking only 1 record. and storing 1 record in second key.
if #2 ~=0 then
return 2
end
if #1 ~=0 then
return 1
end
return 0
I am getting correct result.
[127.0.0.1:6379] > if #2 ~= 0 then
1) "2"
2) "1"
3) "0"
4) nil
But I want the result in reverse order.
A:
You can use in-memory sorted list to store your keys and iterate through them in lua.
You need to use lpush to add keys to sorted list and lrange to iterate through them in reverse order.
script ac619d1d87
Related links:
Comments