summary refs log tree commit diff
path: root/synapse/storage/_base.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-08-15 11:45:57 +0100
committerErik Johnston <erik@matrix.org>2016-08-15 11:45:57 +0100
commitd9664344ecf481a73b2189f5bc65f4f784222969 (patch)
tree561371e33f98b5ef8b4c2e12bd504ebc4ad1857a /synapse/storage/_base.py
parentRemove broken cache stuff (diff)
downloadsynapse-d9664344ecf481a73b2189f5bc65f4f784222969.tar.xz
Rename table. Add docs.
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r--synapse/storage/_base.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index e3edc2cde6..c55776994d 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -863,6 +863,13 @@ class SQLBaseStore(object):
         return cache, min_val
 
     def _invalidate_cache_and_stream(self, txn, cache_func, keys):
+        """Invalidates the cache and adds it to the cache stream so slaves
+        will know to invalidate their caches.
+
+        This should only be used to invalidate caches where slaves won't
+        otherwise know from other replication streams that the cache should
+        be invalidated.
+        """
         txn.call_after(cache_func.invalidate, keys)
 
         if isinstance(self.database_engine, PostgresEngine):
@@ -872,7 +879,7 @@ class SQLBaseStore(object):
 
             self._simple_insert_txn(
                 txn,
-                table="cache_stream",
+                table="cache_invalidation_stream",
                 values={
                     "stream_id": stream_id,
                     "cache_func": cache_func.__name__,
@@ -887,7 +894,8 @@ class SQLBaseStore(object):
             # send across cache invalidations as quickly as possible. Cache
             # invalidations are idempotent, so duplicates are fine.
             sql = (
-                "SELECT stream_id, cache_func, keys, invalidation_ts FROM cache_stream"
+                "SELECT stream_id, cache_func, keys, invalidation_ts"
+                " FROM cache_invalidation_stream"
                 " WHERE stream_id > ? ORDER BY stream_id ASC LIMIT ?"
             )
             txn.execute(sql, (last_id, limit,))