summaryrefslogtreecommitdiff
path: root/common/src/leap/soledad
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2015-09-21 17:19:18 -0300
committerVictor Shyba <victor.shyba@gmail.com>2015-09-24 19:40:51 -0300
commitdf8c794395ee695ea1dfb30603a073b32b24ee58 (patch)
tree77cf94854f35bf0c11c2d2b4aa3fa2ef13a08f02 /common/src/leap/soledad
parentcb7aa314ad4d47e9f32e9e111ec13976978ed02d (diff)
[refactor] init_caching instead of setting attr
As meskio found commented, setting this attribute directly is ugly, CouchDatabase now has a init_caching method for setting up cache instance.
Diffstat (limited to 'common/src/leap/soledad')
-rw-r--r--common/src/leap/soledad/common/couch.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/src/leap/soledad/common/couch.py b/common/src/leap/soledad/common/couch.py
index 014b3f38..00a17715 100644
--- a/common/src/leap/soledad/common/couch.py
+++ b/common/src/leap/soledad/common/couch.py
@@ -443,6 +443,15 @@ class CouchDatabase(CommonBackend):
else:
return {}
+ def init_caching(self, cache):
+ """
+ Start using cache by setting internal _cache attribute.
+
+ :param cache: the cache instance, anything that behaves like a dict
+ :type cache: dict
+ """
+ self._cache = cache
+
def ensure_ddocs_on_db(self):
"""
Ensure that the design documents used by the backend exist on the