Use FlatSet for Redis SETS

Add FlatSet data structure.
Use FlatSet and get rid of t_set functions.
Fix Hash bug. Add memory comparison test
This commit is contained in:
Roman Gershman 2022-03-05 20:20:30 +02:00
parent a58ed46f1e
commit c94d109cff
9 changed files with 524 additions and 133 deletions

View file

@ -11,11 +11,15 @@ import time
def fill_set(args, redis: rclient.Redis):
for j in range(args.num):
token = uuid.uuid1().hex
# print(token)
key = f'USER_OTP:{token}'
otp = ''.join(random.choices(
string.ascii_uppercase + string.digits, k=7))
redis.execute_command('sadd', key, otp)
arr = []
for i in range(30):
otp = ''.join(random.choices(
string.ascii_uppercase + string.digits, k=12))
arr.append(otp)
redis.execute_command('sadd', key, *arr)
def fill_hset(args, redis):
for j in range(args.num):
token = uuid.uuid1().hex