Guest User

Untitled

a guest
Jan 21st, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. import redis
  2.  
  3. REDIS_HOST = '127.0.0.1'
  4. dbr = redis.Redis(host=REDIS_HOST)
  5.  
  6. class Queue(object):
  7. def __init__(self):
  8. local_id = dbr.incr("queue_space")
  9. id_name = "queue:%s" %(local_id)
  10. self.id_name = id_name
  11.  
  12. def push(self, element):
  13. id_name = self.id_name
  14. push_element = redis.lpush(id_name, element)
Add Comment
Please, Sign In to add comment