示例#1
0
 def hvals(self, key):
     result = []
     if self._db.get(KEY_CODEC.encode_hash(key)) is not None:
         for _, db_value in self._get_db_iterator(
                 KEY_CODEC.get_min_hash_field(key)):
             result.append(db_value)
     return result
示例#2
0
文件: keyspace.py 项目: Yipit/dredis
 def hvals(self, key):
     result = []
     key_id, hash_length = self._get_hash_key_id_and_length(key)
     if hash_length > 0:
         for _, db_value in self._get_db_iterator(
                 KEY_CODEC.get_min_hash_field(key_id)):
             result.append(db_value)
     return result
示例#3
0
 def _delete_db_hash(self, key):
     # there are two sets of db keys for hashes:
     # * hash
     # * hash fields
     with self._db.write_batch() as batch:
         batch.delete(KEY_CODEC.encode_hash(key))
         for db_key, _ in self._get_db_iterator(
                 KEY_CODEC.get_min_hash_field(key)):
             batch.delete(db_key)
示例#4
0
 def hgetall(self, key):
     result = []
     if self._db.get(KEY_CODEC.encode_hash(key)) is not None:
         for db_key, db_value in self._get_db_iterator(
                 KEY_CODEC.get_min_hash_field(key)):
             _, length, field_key = KEY_CODEC.decode_key(db_key)
             field = field_key[length:]
             result.append(field)
             result.append(db_value)
     return result
示例#5
0
文件: keyspace.py 项目: Yipit/dredis
 def hgetall(self, key):
     result = []
     key_id, hash_length = self._get_hash_key_id_and_length(key)
     if hash_length > 0:
         for db_key, db_value in self._get_db_iterator(
                 KEY_CODEC.get_min_hash_field(key_id)):
             _, length, field_key = KEY_CODEC.decode_key(db_key)
             field = field_key[length:]
             result.append(field)
             result.append(db_value)
     return result