Created
October 24, 2010 01:54
-
-
Save agladysh/642968 to your computer and use it in GitHub Desktop.
DEL with key list is broken
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pcall(require, 'luarocks.require') | |
local sidereal = require 'sidereal' -- sudo luarocks install sidereal --from=http://luarocks.org/repositories/rocks-cvs | |
-------------------------------------------------------------------------------- | |
-- Some value printing code | |
-------------------------------------------------------------------------------- | |
require 'lua-nucleo.module' -- sudo luarocks install lua-nucleo | |
require 'lua-nucleo.strict' | |
local tstr = import 'lua-nucleo/tstr.lua' { 'tstr' } -- Lua value to string | |
local N = 1 | |
local P = function(...) print(N .. ":", tstr(assert(...))); N = N + 1 end | |
-------------------------------------------------------------------------------- | |
-- Connect to Redis | |
-------------------------------------------------------------------------------- | |
local R = assert(sidereal.connect("localhost", 6379)) | |
R:flushdb() | |
-------------------------------------------------------------------------------- | |
-- Fill data | |
-------------------------------------------------------------------------------- | |
local init = function() | |
assert(R:set("ONE", "one")) | |
assert(R:set("TWO", "two")) | |
end | |
-------------------------------------------------------------------------------- | |
-- This works | |
-------------------------------------------------------------------------------- | |
init() | |
P (R:keys("*")) | |
P (R:del("ONE TWO")) | |
P (R:keys("*")) | |
--[[--> | |
1: {"TWO","ONE"} | |
2: 2 | |
3: {} | |
redis> monitor | |
+1287885125.12932 "KEYS" "*" | |
+1287885125.13170 "DEL" "ONE" "TWO" | |
+1287885125.13544 "KEYS" "*" | |
--]] | |
-------------------------------------------------------------------------------- | |
-- This does not | |
-------------------------------------------------------------------------------- | |
init() | |
P (R:keys("*")) | |
P (R:del({"ONE", "TWO"})) | |
P (R:keys("*")) | |
--[[--> | |
4: {"TWO","ONE"} | |
5: 0 | |
6: {"TWO","ONE"} | |
redis> monitor | |
+1287885125.14731 "KEYS" "*" | |
+1287885125.14932 "DEL" "table:" "0x9c12310" | |
+1287885125.15094 "KEYS" "*" | |
--]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment