From 4b4a02905cc6718e57c69cf065b812d2f0d5da0b Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Thu, 29 Sep 2016 17:18:45 +0200 Subject: [PATCH] Implement the RedisConfigStorage --- .../refactor/storage/server_config.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/server/lib/python/cartodb_services/cartodb_services/refactor/storage/server_config.py b/server/lib/python/cartodb_services/cartodb_services/refactor/storage/server_config.py index 0cea760..3637e3d 100644 --- a/server/lib/python/cartodb_services/cartodb_services/refactor/storage/server_config.py +++ b/server/lib/python/cartodb_services/cartodb_services/refactor/storage/server_config.py @@ -25,13 +25,15 @@ class InMemoryConfigStorage(ConfigStorageInterface): except KeyError: return None - +# TODO move out of this file. In general this is config but either user or org config class RedisConfigStorage(ConfigStorageInterface): - def __init__(self, connection, prefix): + def __init__(self, connection, config_key): self._connection = connection - self._prefix = prefix + self._config_key = config_key + self._data = None def get(self, key): - # TODO: Implement. this is just a stub - return None + if not self._data: + self._data = self._connection.hgetall(self._config_key) + return self._data[key]