I need to implement the Queue in Redis with unique elements. Currently, I am using the Redis List to implement Queue (LPUSH, RPOP) and Redis Sortedset/set to implement uniqueness.
`
def push(key):
if redis_cache.zadd('UNIQUE', key, 1):
redis_cache.lpush('QUEUE', key)
else:
print "Key Exist"
`
`
def pop():
key = redis_cache.rpop('QUEUE')
redis_cache.zrem('UNIQUE', key)
return key
`
With high load/request of keys the Redis Cache server using more CPU. and also the above approach taking more memory size (The same key is sored in both List and Sortedset) Is there any other way to implement the Redis Queue with key uniqueness?