Redis::Script - wrapper class for Redis' script
# OO-interface
use Redis;
use Redis::Script;
my $script = Redis::Script->new(script => "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}");
my ($key1, $key2, $arg1, $arg2) = $script->eval(Redis->new, ['key1', 'key2'], ['arg1', 'arg2']);
# Functional
use Redis::Script qw/redis_eval/;
my ($key1, $key2, $arg1, $arg2) = redis_eval(Redis->new, "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", ['key1', 'key2'], ['arg1', 'arg2']);
Redis::Script is wrapper class for Redis' script.
eval
executes the script by EVALSHA
command.
If EVALSHA
reports "No matching script", use EVAL
instead of EVALSHA
.
Redis will cache the script of EVAL
command, so EVALSHA
will succeed next time.
If use_evalsha
option is false, eval
does not use EVALSHA
command.
exists
reports if $redis
caches the script.
Load a script into the scripts cache, without executing it.
Copyright (C) ICHINOSE Shogo.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
ICHINOSE Shogo shogo82148@gmail.com