mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 08:21:13 -05:00
20 lines
449 B
Python
20 lines
449 B
Python
|
|
from flask.ext.redis import FlaskRedis
|
||
|
|
|
||
|
|
|
||
|
|
class RedisClient:
|
||
|
|
active = False
|
||
|
|
redis_store = FlaskRedis()
|
||
|
|
|
||
|
|
def init_app(self, app):
|
||
|
|
self.active = app.config.get('REDIS_ENABLED')
|
||
|
|
|
||
|
|
if self.active:
|
||
|
|
self.redis_store.init_app(app)
|
||
|
|
|
||
|
|
def set(self, key, value):
|
||
|
|
if self.active:
|
||
|
|
self.redis_store.set(key, value)
|
||
|
|
|
||
|
|
def get(self, key):
|
||
|
|
if self.active:
|
||
|
|
self.redis_store.get(key)
|