lib/wolverine/script.rb
def call redis, *args
      t = Time.now
      begin
        run_evalsha redis, *args
      rescue => e
        e.message =~ /NOSCRIPT/ ? run_eval(redis, *args) : raise
      end
    rescue => e
      if LuaError.intercepts?(e)
        raise LuaError.new(e, @file, @content)
      else
        raise
      end
    ensure
      StatsD.measure(statsd_key, (Time.now - t) * 1000, 0.001) if Wolverine.statsd_enabled?
    end
# Passes the script and supplied arguments to redis for evaulation.
# It first attempts to use a script redis has already cached by using
# the +EVALSHA+ command, but falls back to providing the full script
# text via +EVAL+ if redis has not seen this script before. Future
# invocations will then use +EVALSHA+ without erroring.
#
# @param redis [Redis] the redis connection to run against
# @param args [*Objects] the arguments to the script
# @return [Object] the value passed back by redis after script execution
# @raise [LuaError] if the script failed to compile of encountered a
#   runtime error
Passes the script and supplied arguments to redis for evaulation.
It first attempts to use a script redis has already cached by using
the +EVALSHA+ command, but falls back to providing the full script
text via +EVAL+ if redis has not seen this script before. Future
invocations will then use +EVALSHA+ without erroring.
Passes the script and supplied arguments to redis for evaulation . It first attempts to use a script redis has already cached by using the + EVALSHA + command but falls back to providing the full script text via + EVAL + if redis has not seen this script before . Future invocations will then use + EVALSHA + without erroring .
def call redis, *args
      t = Time.now
      begin
        run_evalsha redis, *args
      rescue => e
        e.message =~ /NOSCRIPT/ ? run_eval(redis, *args) : raise
      end
    rescue => e
      if LuaError.intercepts?(e)
        raise LuaError.new(e, @file, @content)
      else
        raise
      end
    ensure
      StatsD.measure(statsd_key, (Time.now - t) * 1000, 0.001) if Wolverine.statsd_enabled?
    end
def call redis , * args t = Time . now begin run_evalsha redis , * args rescue => e e . message =~ / NOSCRIPT / ? run_eval ( redis , * args ) : raise end rescue => e if LuaError . intercepts? ( e ) raise LuaError . new ( e , @file , @content ) else raise end ensure StatsD . measure ( statsd_key , ( Time . now - t ) * 1000 , 0.001 ) if Wolverine . statsd_enabled? end
Passes the script and supplied arguments to redis for evaulation.
Passes the script and supplied arguments to redis for evaulation .
the value passed back by redis after script execution
the value passed back by redis after script execution
Object
[LuaError] if the script failed to compile of encountered a runtime error
[ LuaError ] if the script failed to compile of encountered a runtime error
redis
the redis connection to run against
the redis connection to run against
args
the arguments to the script
the arguments to the script