redis zincrby zadd 遇到的问题
在维护代理池时
报错1:
zincrby(REDIS_KEY,proxy,-1)
redis.exceptions.ResponseError: value is not a valid float
查看文档后发现zincrby()
更新为
zincrby(self, name, amount, value)
解决方案: zincrby(REDIS_KEY,-1,proxy)
报错2:
zadd(REDIS_KEY, score, proxy)
redis 'int' object has no attribute 'items'
文档更新为
zadd(self, name, mapping, nx=False, xx=False, ch=False, incr=False)
Set any number of element-name, score pairs to the key ``name``. Pairs
are specified as a dict of element-names keys to score values.
解决方案
zadd(REDIS_KEY,{proxy:score})
---------------------