lib/redis/namespace.rb
def method_missing(command, *args, &block)
      normalized_command = command.to_s.downcase

      if COMMANDS.include?(normalized_command)
        send(normalized_command, *args, &block)
      elsif @redis.respond_to?(normalized_command) && !deprecations?
        # blind passthrough is deprecated and will be removed in 2.0
        # redis-namespace does not know how to handle this command.
        # Passing it to @redis as is, where redis-namespace shows
        # a warning message if @warning is set.
        if warning?
          warn("Passing '#{command}' command to redis as is; blind " +
               "passthrough has been deprecated and will be removed in " +
               "redis-namespace 2.0 (at #{call_site})")
        end
        @redis.send(command, *args, &block)
      else
        super
      end
    end
# The following tables define how input parameters and result
# values should be modified for the namespace.
#
# COMMANDS is a hash. Each key is the name of a command and each
# value is a two element array.
#
# The first element in the value array describes how to modify the
# arguments passed. It can be one of:
#
#   nil
#     Do nothing.
#   :first
#     Add the namespace to the first argument passed, e.g.
#       GET key => GET namespace:key
#   :all
#     Add the namespace to all arguments passed, e.g.
#       MGET key1 key2 => MGET namespace:key1 namespace:key2
#   :exclude_first
#     Add the namespace to all arguments but the first, e.g.
#   :exclude_last
#     Add the namespace to all arguments but the last, e.g.
#       BLPOP key1 key2 timeout =>
#       BLPOP namespace:key1 namespace:key2 timeout
#   :exclude_options
#     Add the namespace to all arguments, except the last argument,
#     if the last argument is a hash of options.
#       ZUNIONSTORE key1 2 key2 key3 WEIGHTS 2 1 =>
#       ZUNIONSTORE namespace:key1 2 namespace:key2 namespace:key3 WEIGHTS 2 1
#   :alternate
#     Add the namespace to every other argument, e.g.
#       MSET key1 value1 key2 value2 =>
#       MSET namespace:key1 value1 namespace:key2 value2
#   :sort
#     Add namespace to first argument if it is non-nil
#     Add namespace to second arg's :by and :store if second arg is a Hash
#     Add namespace to each element in second arg's :get if second arg is
#       a Hash; forces second arg's :get to be an Array if present.
#   :eval_style
#     Add namespace to each element in keys argument (via options hash or multi-args)
#   :scan_style
#     Add namespace to :match option, or supplies "#{namespace}:*" if not present.
#
# The second element in the value array describes how to modify
# the return value of the Redis call. It can be one of:
#
#   nil
#     Do nothing.
#   :all
#     Add the namespace to all elements returned, e.g.
#       key1 key2 => namespace:key1 namespace:key2
The following tables define how input parameters and result
values should be modified for the namespace.

COMMANDS is a hash. Each key is the name of a command and each
value is a two element array.

The first element in the value array describes how to modify the
arguments passed. It can be one of.

nil
Do nothing.
:first
Add the namespace to the first argument passed, e.g.
GET key => GET namespace:key
:all
Add the namespace to all arguments passed, e.g.
MGET key1 key2 => MGET namespace:key1 namespace:key2
:exclude_first
Add the namespace to all arguments but the first, e.g.
:exclude_last
Add the namespace to all arguments but the last, e.g.
BLPOP key1 key2 timeout =>
BLPOP namespace:key1 namespace:key2 timeout
:exclude_options
Add the namespace to all arguments, except the last argument,
if the last argument is a hash of options.
ZUNIONSTORE key1 2 key2 key3 WEIGHTS 2 1 =>
ZUNIONSTORE namespace:key1 2 namespace:key2 namespace:key3 WEIGHTS 2 1
:alternate
Add the namespace to every other argument, e.g.

The second element in the value array describes how to modify
the return value of the Redis call. It can be one of.

nil
Do nothing.
:all
Add the namespace to all elements returned, e.g.
key1 key2 => namespace:key1 namespace:key2
The following tables define how input parameters and result values should be modified for the namespace . COMMANDS is a hash . Each key is the name of a command and each value is a two element array . The first element in the value array describes how to modify the arguments passed . It can be one of . nil Do nothing . : first Add the namespace to the first argument passed e . g . GET key = > GET namespace : key : all Add the namespace to all arguments passed e . g . MGET key1 key2 = > MGET namespace : key1 namespace : key2 : exclude_first Add the namespace to all arguments but the first e . g . : exclude_last Add the namespace to all arguments but the last e . g . BLPOP key1 key2 timeout = > BLPOP namespace : key1 namespace : key2 timeout : exclude_options Add the namespace to all arguments except the last argument if the last argument is a hash of options . ZUNIONSTORE key1 2 key2 key3 WEIGHTS 2 1 = > ZUNIONSTORE namespace : key1 2 namespace : key2 namespace : key3 WEIGHTS 2 1 : alternate Add the namespace to every other argument e . g . The second element in the value array describes how to modify the return value of the Redis call . It can be one of . nil Do nothing . : all Add the namespace to all elements returned e . g . key1 key2 = > namespace : key1 namespace : key2
def method_missing(command, *args, &block)
      normalized_command = command.to_s.downcase
      if COMMANDS.include?(normalized_command)
        send(normalized_command, *args, &block)
      elsif @redis.respond_to?(normalized_command) && !deprecations?
        if warning?
          warn("Passing '#{command}' command to redis as is; blind " +
               "passthrough has been deprecated and will be removed in " +
               "redis-namespace 2.0 (at #{call_site})")
        end
        @redis.send(command, *args, &block)
      else
        super
      end
    end
def method_missing ( command , * args , & block ) normalized_command = command . to_s . downcase if COMMANDS . include? ( normalized_command ) send ( normalized_command , * args , & block ) elsif @redis . respond_to? ( normalized_command ) && ! deprecations? if warning? warn ( "Passing '#{command}' command to redis as is; blind " + "passthrough has been deprecated and will be removed in " + "redis-namespace 2.0 (at #{call_site})" ) end @redis . send ( command , * args , & block ) else super end end
The following tables define how input parameters and result
values should be modified for the namespace.
The following tables define how input parameters and result values should be modified for the namespace .
# blind passthrough is deprecated and will be removed in 2.0 # redis-namespace does not know how to handle this command. # Passing it to @redis as is, where redis-namespace shows # a warning message if @warning is set.
command
args
block