Module: RedisLua

Included in:
DistributeLock, LoadBalancer::Algo
Defined in:
lib/multi_dbs_load_balancer/redis_lua.rb

Class Method Summary collapse

Class Method Details

.eval_lua_script(script, sha1, *args, redis: @redis, **kwargs) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/multi_dbs_load_balancer/redis_lua.rb', line 2

def eval_lua_script(script, sha1, *args, redis: @redis,**kwargs)
    redis.evalsha sha1, *args, **kwargs
rescue ::Redis::CommandError => e
    if e.to_s =~ /^NOSCRIPT/
        redis.eval script, *args, **kwargs
    else
        raise
    end
end