mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
Adding Flask-Redis to the project.
[https://pypi.python.org/pypi/Flask-Redis/0.1.0](https://pypi.python.org/pypi/Flask-Redis/0.1.0) Initial addition as we think about redis as cache.
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user