Returns hash with information about a given Redis
771425
def redis_info url, password
      begin
        r = Redis.new url: url, password: password
        info = r.info.merge 'dbsize' => r.dbsize
      rescue Exception => e
        STDERR.puts "[ERROR][#{__FILE__}:#{__LINE__}] Failed to get data from Redis - " +
          "#{url.inspect} (using password #{password.inspect}): #{e.message}\n#{e.backtrace.join("\n")}"
        return {}
      end

      begin
        info['maxmemory'] = @options.fetch(:max_memory) { r.config(:get, 'maxmemory')['maxmemory'] }
      rescue Exception
        info['maxmemory'] = info['used_memory_rss']
      end

      r.quit

      {
        'connections'     => info['connected_clients'].to_i,
        'used_memory'     => info['used_memory'].to_f,
        'used_memory_rss' => info['used_memory_rss'].to_f,
        'fragmentation'   => info['mem_fragmentation_ratio'].to_f,
        'expired_keys'    => info['expired_keys'].to_i,
        'evicted_keys'    => info['evicted_keys'].to_i,
        'hits'            => info['keyspace_hits'].to_i,
        'misses'          => info['keyspace_misses'].to_i,
        'keys'            => info['dbsize'].to_i,
        'max_memory'      => info['maxmemory'].to_i,
        'hit_ratio'       => 0
      }.tap {|d| d['hit_ratio'] = d['hits'].to_f / (d['hits']+d['misses']).to_f if d['hits'] > 0 }
    end
1200958
def redact(digest=:sha1)
      raise "Unknown Digest type: #{digest}" unless %i(sha1 md5).include?(digest)
      return self.to_s if self.local.redacted?
      r = %Q({#{send(digest)}})
      r += "@" + self.host.to_s if self.host.to_s && self.host.to_s > " "
      r
    end
272232
def static_url(redis, path):
    """"""
    file_hash = get_cache_buster(redis, path)
    return "%s/%s?v=%s" % (oz.settings["static_host"], path, file_hash)
1275438
def _get_bank_keys_redis_key(bank):
    '''
    
    '''
    opts = _get_redis_keys_opts()
    return '{prefix}{separator}{bank}'.format(
        prefix=opts['bank_keys_prefix'],
        separator=opts['separator'],
        bank=bank
    )
1265006
def keys_with_ttl(pattern = SCAN_PATTERN, count = DEFAULT_COUNT)
      hash = {}
      redis do |conn|
        conn.scan_each(match: prefix(pattern), count: count).each do |key|
          hash[key] = conn.ttl(key)
        end
      end
      hash
    end
197265
def store_hash_configuration(self, lshash):
        
        self.redis_object.set(lshash.hash_name+'_conf', pickle.dumps(lshash.get_config()))
1051359
def get(cls, id):
        '''  '''

        if not id:
            return None

        redis = cls.get_redis()
        key = '{}:{}:obj'.format(cls.cls_key(), id)

        if not redis.exists(key):
            return None

        obj = cls(id=id)
        obj._persisted = True

        data = debyte_hash(redis.hgetall(key))

        for fieldname, field in obj.proxy:
            value = field.recover(data, redis)

            setattr(
                obj,
                fieldname,
                value
            )

        return obj
919935
def read_and_hash(fname, **kw):
    '''
    
    '''
    return [addhash(frame, **kw) for frame in read(fname, **kw)];
1090081
def hash(self):
        '''
        
        '''
        hashed = super(Dynamic, self).hash()
        return khash(hashed, self._key, self._length)
1065737
def read_hashes(self):
        
        var_len = self.read_var_int()
        items = []
        for _ in range(0, var_len):
            ba = bytearray(self.read_bytes(32))
            ba.reverse()
            items.append(ba.hex())
        return items
1295433
def get_hash(name)
      if (item = dynamo_get_item(name))
        JSON.parse(item)
      else
        ::Hash.new
      end
    end
93391
def to_hash
        h = {}
        keys.each { |k| h[ k ] = self.fetch( k ) }
        h
    end
541774
def dump(self, name):
        
        with self.pipe as pipe:
            return pipe.dump(self.redis_key(name))
498428
def infohash_base32(self):
        """"""
        self.validate()
        info = self.convert()[b'info']
        return b32encode(sha1(bencode(info)).digest())
789941
def to_hash
      result = {
        name: @name,
        value: @value,
        domain: @domain,
        path: @path,
        created_at: @created_at
      }
      {
        expiry: @expiry,
        secure: (true if @secure),
        http_only: (true if @http_only),
        version: (@version if version != 0),
        comment: @comment,
        comment_url: @comment_url,
        discard: (true if @discard),
        ports: @ports
      }.each do |name, value|
        result[name] = value if value
      end

      result
    end
202507
def GetHashersInformation(cls):
    
    hashers_information = []
    for _, hasher_class in cls.GetHasherClasses():
      description = getattr(hasher_class, 'DESCRIPTION', '')
      hashers_information.append((hasher_class.NAME, description))

    return hashers_information
326322
def hash(self, rtdc_ds):
        
        hasher = hashlib.md5()
        # data columns
        for col in self.req_features:
            hasher.update(obj2str(rtdc_ds[col]))
        # config keys
        for sec, keys in self.req_config:
            for key in keys:
                val = rtdc_ds.config[sec][key]
                data = "{}:{}={}".format(sec, key, val)
                hasher.update(obj2str(data))
        return hasher.hexdigest()