代码
# -*- coding: utf-8 -*-
# @Author : zbz
import time
import random
from redis import Redis
t1 = time.time()
db = Redis(db=8)
values = []
n = 0
for _ in range(100_0006):
value = f"{random.randint(1, 10000)}-{random.randint(1, 10000)}-{random.randint(1, 10000)}"
values.append(value)
if len(values) == 10000:
db.lpush("test:t1", *values)
values.clear()
n += 1
print(f"success, {n}w条数据")
db.lpush("test:t1", *values)
print(f"耗时: {time.time() - t1}")