mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-02 09:41:07 +00:00
add list_items for wildcard matching
This commit is contained in:
parent
e0db73543e
commit
c4d6bb35a3
@ -59,6 +59,19 @@ class RedisArchivist:
|
|||||||
|
|
||||||
return json_str
|
return json_str
|
||||||
|
|
||||||
|
def list_items(self, query):
|
||||||
|
"""list all matches"""
|
||||||
|
reply = self.redis_connection.execute_command(
|
||||||
|
"KEYS", self.NAME_SPACE + query + "*"
|
||||||
|
)
|
||||||
|
all_matches = [i.decode().lstrip(self.NAME_SPACE) for i in reply]
|
||||||
|
all_results = []
|
||||||
|
for match in all_matches:
|
||||||
|
json_str = self.get_message(match)
|
||||||
|
all_results.append(json_str)
|
||||||
|
|
||||||
|
return all_results
|
||||||
|
|
||||||
def del_message(self, key):
|
def del_message(self, key):
|
||||||
"""delete key from redis"""
|
"""delete key from redis"""
|
||||||
response = self.redis_connection.execute_command(
|
response = self.redis_connection.execute_command(
|
||||||
|
Loading…
Reference in New Issue
Block a user