mirror of
https://github.com/tubearchivist/tubearchivist.git
synced 2024-12-23 10:20:13 +00:00
add contains to RedisQueue
This commit is contained in:
parent
3b3d151ec3
commit
2753ce93a2
@ -114,6 +114,11 @@ class RedisQueue(RedisBase):
|
||||
all_elements = [i.decode() for i in result]
|
||||
return all_elements
|
||||
|
||||
def contains(self, element):
|
||||
"""check if element is in list"""
|
||||
result = self.conn.execute_command("LPOS", self.key, element)
|
||||
return result is not None
|
||||
|
||||
def add_list(self, to_add):
|
||||
"""add list to queue"""
|
||||
self.conn.execute_command("RPUSH", self.key, *to_add)
|
||||
|
Loading…
Reference in New Issue
Block a user