summaryrefslogtreecommitdiff
path: root/common/src/leap/soledad
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2015-09-20 17:47:07 -0300
committerVictor Shyba <victor.shyba@gmail.com>2015-09-24 19:40:51 -0300
commit0e954f3328b7b8c31c88e0bee796230e87bca829 (patch)
treefb70bebfe0d8d363d4516ce6d4b61497d5be3395 /common/src/leap/soledad
parentfc5f4ae965ca48946af9f6982b2719562168131c (diff)
[feat] adds cache expiration
Now each backend object will be retrieved from cache for sync.py and values will live for 3600 by default. That is changed via parameter if needed.
Diffstat (limited to 'common/src/leap/soledad')
-rw-r--r--common/src/leap/soledad/common/couch.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/src/leap/soledad/common/couch.py b/common/src/leap/soledad/common/couch.py
index 83f542ab..809af05d 100644
--- a/common/src/leap/soledad/common/couch.py
+++ b/common/src/leap/soledad/common/couch.py
@@ -527,6 +527,7 @@ class CouchDatabase(CommonBackend):
try:
# grab replica_uid from server
doc = self._database['u1db_config']
+ self.cache[self._url] = doc
self._real_replica_uid = doc['replica_uid']
return self._real_replica_uid
except ResourceNotFound:
@@ -1154,6 +1155,7 @@ class CouchDatabase(CommonBackend):
doc['generation'] = other_generation
doc['transaction_id'] = other_transaction_id
self._database.save(doc)
+ self.cache[other_replica_uid] = (other_generation, other_transaction_id)
def _force_doc_sync_conflict(self, doc):
"""