Skip to content

Instantly share code, notes, and snippets.

@itamarhaber
Created June 27, 2021 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itamarhaber/5519a182b3e5a21859ed1d0d80a537bc to your computer and use it in GitHub Desktop.
Save itamarhaber/5519a182b3e5a21859ed1d0d80a537bc to your computer and use it in GitHub Desktop.
Dump a Redis key in TCL binary string encoding
-- DUMPs a Redis key in TCL-compatible binary string encoding
local b = redis.call("DUMP",KEYS[1])
local s = ""
for i = 1, string.len(b), 1 do
s = s .. string.format("\\x%02X",string.byte(b,i))
end
return s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment