diff options
author | Erik Johnston <erik@matrix.org> | 2017-03-20 17:25:41 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-03-20 17:25:41 +0000 |
commit | e0e214556a82370528ef1f9943773c42270c5336 (patch) | |
tree | 7fcbb016a63202eb1733e6b69a4999ba94193e8c /synapse/util/caches | |
parent | Merge pull request #2028 from majewsky/readme-fix-1 (diff) | |
parent | Bump changelog and version (diff) | |
download | synapse-e0e214556a82370528ef1f9943773c42270c5336.tar.xz |
Merge branch 'release-v0.19.3' of github.com:matrix-org/synapse v0.19.3
Diffstat (limited to 'synapse/util/caches')
-rw-r--r-- | synapse/util/caches/expiringcache.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/util/caches/expiringcache.py b/synapse/util/caches/expiringcache.py index 2987c38a2d..cbdde34a57 100644 --- a/synapse/util/caches/expiringcache.py +++ b/synapse/util/caches/expiringcache.py @@ -100,6 +100,13 @@ class ExpiringCache(object): except KeyError: return default + def setdefault(self, key, value): + try: + return self[key] + except KeyError: + self[key] = value + return value + def _prune_cache(self): if not self._expiry_ms: # zero expiry time means don't expire. This should never get called |