diff options
author | Richard van der Hoff <richard@matrix.org> | 2017-03-13 12:20:47 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2017-03-13 12:20:47 +0000 |
commit | 3c69f324024db9868bdec42a9aceb666c48d209f (patch) | |
tree | 1e09876712257aebb5fb63c41c7e9c97908ba11e /synapse/util/caches/expiringcache.py | |
parent | Move FederationServer._handle_new_pdu to FederationHandler (diff) | |
parent | Merge pull request #1983 from matrix-org/rav/no_redirect_stdio (diff) | |
download | synapse-3c69f324024db9868bdec42a9aceb666c48d209f.tar.xz |
Merge remote-tracking branch 'origin/develop' into rav/refactor_received_pdu
Diffstat (limited to 'synapse/util/caches/expiringcache.py')
-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 |