Class Redis::Namespace
In: lib/redis/namespace/version.rb
lib/redis/namespace.rb
Parent: Object

Methods

Constants

VERSION = '1.6.0'
NAMESPACED_COMMANDS = { "append" => [ :first ], "bitcount" => [ :first ], "bitop" => [ :exclude_first ], "blpop" => [ :exclude_last, :first ], "brpop" => [ :exclude_last, :first ], "brpoplpush" => [ :exclude_last ], "debug" => [ :exclude_first ], "decr" => [ :first ], "decrby" => [ :first ], "del" => [ :all ], "dump" => [ :first ], "exists" => [ :first ], "expire" => [ :first ], "expireat" => [ :first ], "eval" => [ :eval_style ], "evalsha" => [ :eval_style ], "get" => [ :first ], "getbit" => [ :first ], "getrange" => [ :first ], "getset" => [ :first ], "hset" => [ :first ], "hsetnx" => [ :first ], "hget" => [ :first ], "hincrby" => [ :first ], "hincrbyfloat" => [ :first ], "hmget" => [ :first ], "hmset" => [ :first ], "hdel" => [ :first ], "hexists" => [ :first ], "hlen" => [ :first ], "hkeys" => [ :first ], "hscan" => [ :first ], "hscan_each" => [ :first ], "hvals" => [ :first ], "hgetall" => [ :first ], "incr" => [ :first ], "incrby" => [ :first ], "incrbyfloat" => [ :first ], "keys" => [ :first, :all ], "lindex" => [ :first ], "linsert" => [ :first ], "llen" => [ :first ], "lpop" => [ :first ], "lpush" => [ :first ], "lpushx" => [ :first ], "lrange" => [ :first ], "lrem" => [ :first ], "lset" => [ :first ], "ltrim" => [ :first ], "mapped_hmset" => [ :first ], "mapped_hmget" => [ :first ], "mapped_mget" => [ :all, :all ], "mapped_mset" => [ :all ], "mapped_msetnx" => [ :all ], "mget" => [ :all ], "monitor" => [ :monitor ], "move" => [ :first ], "mset" => [ :alternate ], "msetnx" => [ :alternate ], "object" => [ :exclude_first ], "persist" => [ :first ], "pexpire" => [ :first ], "pexpireat" => [ :first ], "pfadd" => [ :first ], "pfcount" => [ :all ], "pfmerge" => [ :all ], "psetex" => [ :first ], "psubscribe" => [ :all ], "pttl" => [ :first ], "publish" => [ :first ], "punsubscribe" => [ :all ], "rename" => [ :all ], "renamenx" => [ :all ], "restore" => [ :first ], "rpop" => [ :first ], "rpoplpush" => [ :all ], "rpush" => [ :first ], "rpushx" => [ :first ], "sadd" => [ :first ], "scard" => [ :first ], "scan" => [ :scan_style, :second ], "scan_each" => [ :scan_style, :all ], "sdiff" => [ :all ], "sdiffstore" => [ :all ], "set" => [ :first ], "setbit" => [ :first ], "setex" => [ :first ], "setnx" => [ :first ], "setrange" => [ :first ], "sinter" => [ :all ], "sinterstore" => [ :all ], "sismember" => [ :first ], "smembers" => [ :first ], "smove" => [ :exclude_last ], "sort" => [ :sort ], "spop" => [ :first ], "srandmember" => [ :first ], "srem" => [ :first ], "sscan" => [ :first ], "sscan_each" => [ :first ], "strlen" => [ :first ], "subscribe" => [ :all ], "sunion" => [ :all ], "sunionstore" => [ :all ], "ttl" => [ :first ], "type" => [ :first ], "unsubscribe" => [ :all ], "zadd" => [ :first ], "zcard" => [ :first ], "zcount" => [ :first ], "zincrby" => [ :first ], "zinterstore" => [ :exclude_options ], "zrange" => [ :first ], "zrangebyscore" => [ :first ], "zrank" => [ :first ], "zrem" => [ :first ], "zremrangebyrank" => [ :first ], "zremrangebyscore" => [ :first ], "zrevrange" => [ :first ], "zrevrangebyscore" => [ :first ], "zrevrank" => [ :first ], "zscan" => [ :first ], "zscan_each" => [ :first ], "zscore" => [ :first ], "zunionstore" => [ :exclude_options ], "[]" => [ :first ], "[]=" => [ :first ]   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
TRANSACTION_COMMANDS = { "discard" => [], "exec" => [], "multi" => [], "unwatch" => [ :all ], "watch" => [ :all ], }
HELPER_COMMANDS = { "auth" => [], "disconnect!" => [], "echo" => [], "ping" => [], "time" => [], }
ADMINISTRATIVE_COMMANDS = { "bgrewriteaof" => [], "bgsave" => [], "config" => [], "dbsize" => [], "flushall" => [], "flushdb" => [], "info" => [], "lastsave" => [], "quit" => [], "randomkey" => [], "save" => [], "script" => [], "select" => [], "shutdown" => [], "slaveof" => [], }
DEPRECATED_COMMANDS = [ ADMINISTRATIVE_COMMANDS
COMMANDS = [ NAMESPACED_COMMANDS, TRANSACTION_COMMANDS, HELPER_COMMANDS, ADMINISTRATIVE_COMMANDS, ].compact.reduce(:merge)
Enumerator = Enumerable::Enumerator unless defined?(::Enumerator)   Support 1.8.7 by providing a namespaced reference to Enumerable::Enumerator

External Aliases

respond_to? -> self_respond_to?

Attributes

namespace  [W] 
redis  [R] 
warning  [RW] 

Public Class methods

Public Instance methods

emulate Ruby 1.9+ and keep respond_to_missing? logic together.

Ruby defines a now deprecated type method so we need to override it here since it will never hit method_missing

[Validate]