module MeRedis::ZipKeys

how to use: Redis.prepend( MeRedis::KeyMinimizer )

Public Class Methods

prepended(base) click to toggle source
# File lib/me_redis/zip_keys.rb, line 6
def self.prepended(base)
  base.extend( MeRedis::ClassMethods )
end

Public Instance Methods

decr(key) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 41
def decr(key); super(zip_key(key)) end
decrby( key, decrement ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 44
def decrby( key, decrement ); super(zip_key(key), decrement) end
del(*keys) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 53
def del(*keys); super( *keys.map{ |key| zip_key(key) } ) end
exists(key) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 39
def exists(key); super( zip_key(key) ) end
get( key ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 37
def get( key ); super( zip_key(key) ) end
getset( key, value ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 50
def getset( key, value );  super( zip_key(key), value ) end
hdel( key, hkey ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 26
def hdel( key, hkey ); super( zip_key(key), hkey ) end
hexists( key, hkey ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 29
def hexists( key, hkey ); super( zip_key(key), hkey ) end
hget( key, hkey ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 30
def hget( key, hkey );  super( zip_key(key), hkey ) end
hincrby( key, hkey, value ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 31
def hincrby( key, hkey, value ); super( zip_key(key), hkey, value ) end
hmget( key, *args ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 33
def hmget( key, *args ); super( zip_key(key), *args ) end
hmset( key, *args ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 32
def hmset( key, *args ); super( zip_key(key), *args ) end
hset( key, hkey, value ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 27
def hset( key, hkey, value );  super( zip_key(key), hkey, value ) end
hsetnx( key, hkey, value ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 28
def hsetnx( key, hkey, value );  super( zip_key(key), hkey, value ) end
incr( key ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 36
def incr( key ); super( zip_key(key) ) end
keys( pattern ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 21
def keys( pattern )
  super( me_key(pattern) )
end
me_key( key )
Alias for: zip_key
mget( *keys ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 48
def mget( *keys ); super( *keys.map!{ |k| zip_key(k) } ) end
move(key, db) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 51
def move(key, db); super( zip_key(key), db ) end
mset( *key_values ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 47
def mset( *key_values ); super( *key_values.each_slice(2).map{ |k,v| [zip_key(k),v] }.flatten ) end
persist(key) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 42
def persist(key); super(zip_key(key)) end
rename(old_name, new_name) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 55
def rename(old_name, new_name); super( zip_key(old_name), zip_key(new_name) ) end
renamenx(old_name, new_name) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 56
def renamenx(old_name, new_name); super( zip_key(old_name), zip_key(new_name) ) end
set( key, value, options = {} ) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 45
def set( key, value, options = {} );  super( zip_key(key), value, options ) end
ttl(key) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 46
def ttl(key); super( zip_key(key) ) end
type(key) click to toggle source
Calls superclass method
# File lib/me_redis/zip_keys.rb, line 40
def type(key); super(zip_key(key)) end
zip_key( key ) click to toggle source
# File lib/me_redis/zip_keys.rb, line 10
def zip_key( key )
  key.to_s.split( self.class.key_zip_regxp ).map do |zip_me|
    if zip_me.to_i != 0
      zip_me.to_i.to_base62
    else
      self.class.zip_crumbs&.send(:[], zip_me ) || zip_me
    end
  end.join
end
Also aliased as: me_key