def dynamic_encoding_switch(instance: redis.StrictRedis): emptyDB(instance) hash_max_ziplist_entiries = instance.config_get("hash-max-ziplist-entries") print(hash_max_ziplist_entiries) for i in range(515): instance.hset("test-hash", i, 1) if i > 510: debug = instance.debug_object("test-hash") print("Count: {} Length: {} Enconding: {}".format( i, debug.get('serializedlength'), debug.get('encoding')))
def size(instance: redis.StrictRedis, key: str): debug = instance.debug_object(key) return debug.get("serializedlength")