redis 集合
redis 事务:
事物开始后,查询数据 不会返回
from rediscluster import StrictRedisCluster
import redis
from common.common_wckjenv import logger
def wckjRedisCluster(): #StrictRedis
startup_nodes = [
{"host": "10.10.2.67","port": "6379"},
]
r = StrictRedisCluster(startup_nodes=startup_nodes,password="a123456")
#r.on_
#r.execute_command("auth", "a123456")
r.sdiff("xjb:cit:product:sku:0:1")
class MyRedis(redis.Redis):
def __init__(self):
super(MyRedis, self).__init__(host='10.10.2.67', port=6379, db=0, password="a123456")
if __name__ == "__main__":
A =MyRedis()
data_key = "xjb:cit:product:sku:0:1"
data = A.sdiff(data_key)
logger.info(data)
data = A.spop(data_key)
logger.info(data)
data = A.sdiff(data_key)
logger.info(data)
原文:https://www.cnblogs.com/wanderingfish/p/11012850.html