diff options
author | David Baker <dave@matrix.org> | 2016-01-22 11:49:59 +0000 |
---|---|---|
committer | David Baker <dave@matrix.org> | 2016-01-22 11:49:59 +0000 |
commit | 5b142788d22fc5c225b4897a914ddf96cfd6a1f0 (patch) | |
tree | 5df929fb067e4edd5c94c6e46b02ce3c5745179f /synapse | |
parent | Docs for treecache (diff) | |
download | synapse-5b142788d22fc5c225b4897a914ddf96cfd6a1f0.tar.xz |
Add __contains__
Diffstat (limited to '')
-rw-r--r-- | synapse/util/caches/treecache.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/util/caches/treecache.py b/synapse/util/caches/treecache.py index 2d014e1f92..3b58860910 100644 --- a/synapse/util/caches/treecache.py +++ b/synapse/util/caches/treecache.py @@ -13,6 +13,9 @@ class TreeCache(object): def __setitem__(self, key, value): return self.set(key, value) + def __contains__(self, key): + return self.get(key, SENTINEL) is not SENTINEL + def set(self, key, value): node = self.root for k in key[:-1]: |