module MeRedis::ZipToHash::PrependMethods

Public Class Methods

new(*args, &block) click to toggle source
Calls superclass method
# File lib/me_redis/zip_to_hash.rb, line 6
def initialize(*args, &block)
  super(*args, &block)

  # hash-max-ziplist-entries must be cashed, we can't ask Redis every time we need to zip keys,
  # cause it's less performant and impossible during pipelining.
  _config = config(:get, 'hash-max-ziplist-*' )
  @hash_max_ziplist_entries = _config['hash-max-ziplist-entries'].to_i
  if self.class.me_config.hash_max_ziplist_entries && @hash_max_ziplist_entries != self.class.me_config.hash_max_ziplist_entries
    #if me_config configures hash-max-ziplist-entries than we assume it global
    config(:set, 'hash-max-ziplist-entries', self.class.me_config.hash_max_ziplist_entries )
  end

  if self.class.me_config.hash_max_ziplist_value &&
      self.class.me_config.hash_max_ziplist_value != _config['hash-max-ziplist-value'].to_i

    config(:set, 'hash-max-ziplist-value', self.class.me_config.hash_max_ziplist_value)
  end
end

Public Instance Methods

config(action, *args) click to toggle source
Calls superclass method
# File lib/me_redis/zip_to_hash.rb, line 25
def config(action, *args)
  @hash_max_ziplist_entries = args[1].to_i if action.to_s == 'set' && args[0] == 'hash-max-ziplist-entries'
  super( action, *args )
end