Skip to content

Instantly share code, notes, and snippets.

@abiank
Forked from rbraband/example 1
Created February 23, 2013 13:28
Show Gist options
  • Save abiank/5019736 to your computer and use it in GitHub Desktop.
Save abiank/5019736 to your computer and use it in GitHub Desktop.
# Step 0 -- create test data
redis-cli HSET :object:30343552:data foo bar
# Step 1 -- store sample function 'sampleFunction'
redis-cli SET :functions:sample "redis.call('SELECT', 0);local data=redis.call('HGETALL',':object:' .. ARGV[1] .. ':data');return data"
# Step 2 -- create function loader
redis-cli SCRIPT LOAD "f=loadstring(redis.call('get',':functions:' .. KEYS[1]));return f()"
# Step 3 -- test
redis-cli EVALSHA 7b951bb1cb58cb9de1dee3cb6f79fb089911ff8f 1 sampleFunction 30343552
# have fun :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment