Skip to content

Commit

Permalink
models/engine/redis: Prepare for communication between the daemon and…
Browse files Browse the repository at this point in the history
… bot

Signed-off-by: ZorEl212 <[email protected]>
  • Loading branch information
ZorEl212 committed Oct 31, 2024
1 parent 452f744 commit 1358113
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion models/engine/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ class Redis:
def __init__(self):
self.redis = redis.Redis(host=os.getenv('REDIS_HOST', 'localhost'),
port=os.getenv('REDIS_PORT', 6379), db=0)


def publish(self, channel, data):
self.publish(channel, data)

def pubsub(self):
return self.redis.pubsub()

def all(self):
keys = self.redis.keys()
return {key.decode('utf-8'): self.redis.get(key).decode('utf-8') for key in keys}
Expand Down

0 comments on commit 1358113

Please sign in to comment.