Files
notifications-api/app/clients/redis/redis_client.py
2016-11-07 11:55:59 +00:00

23 lines
523 B
Python

import redis
class RedisClient:
def init_app(self, app, *args, **kwargs):
self.active = app.config.get('REDIS_ENABLED')
self.redis = None
if self.active:
self.redis = redis.StrictRedis(
app.config.get('REDIS_HOST'),
app.config.get('REDIS_PORT')
)
def set(self, key, value):
self.redis.set(key, value)
def get(self, key):
return self.redis.get(key)
def incr(self, key):
return self.redis.incr(key)