mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-12-15 17:28:54 -05:00
Rename Cache->DeferredCache
This commit is contained in:
parent
7eff59ec91
commit
9f87da0a84
8 changed files with 30 additions and 25 deletions
|
|
@ -20,14 +20,14 @@ from mock import Mock
|
|||
from twisted.internet import defer
|
||||
|
||||
from synapse.util.async_helpers import ObservableDeferred
|
||||
from synapse.util.caches.descriptors import Cache, cached
|
||||
from synapse.util.caches.descriptors import DeferredCache, cached
|
||||
|
||||
from tests import unittest
|
||||
|
||||
|
||||
class CacheTestCase(unittest.HomeserverTestCase):
|
||||
class DeferredCacheTestCase(unittest.HomeserverTestCase):
|
||||
def prepare(self, reactor, clock, homeserver):
|
||||
self.cache = Cache("test")
|
||||
self.cache = DeferredCache("test")
|
||||
|
||||
def test_empty(self):
|
||||
failed = False
|
||||
|
|
@ -56,7 +56,7 @@ class CacheTestCase(unittest.HomeserverTestCase):
|
|||
self.assertTrue(failed)
|
||||
|
||||
def test_eviction(self):
|
||||
cache = Cache("test", max_entries=2)
|
||||
cache = DeferredCache("test", max_entries=2)
|
||||
|
||||
cache.prefill(1, "one")
|
||||
cache.prefill(2, "two")
|
||||
|
|
@ -74,7 +74,7 @@ class CacheTestCase(unittest.HomeserverTestCase):
|
|||
cache.get(3)
|
||||
|
||||
def test_eviction_lru(self):
|
||||
cache = Cache("test", max_entries=2)
|
||||
cache = DeferredCache("test", max_entries=2)
|
||||
|
||||
cache.prefill(1, "one")
|
||||
cache.prefill(2, "two")
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
from synapse.metrics import REGISTRY, InFlightGauge, generate_latest
|
||||
from synapse.util.caches.descriptors import Cache
|
||||
from synapse.util.caches.descriptors import DeferredCache
|
||||
|
||||
from tests import unittest
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ class CacheMetricsTests(unittest.HomeserverTestCase):
|
|||
Caches produce metrics reflecting their state when scraped.
|
||||
"""
|
||||
CACHE_NAME = "cache_metrics_test_fgjkbdfg"
|
||||
cache = Cache(CACHE_NAME, max_entries=777)
|
||||
cache = DeferredCache(CACHE_NAME, max_entries=777)
|
||||
|
||||
items = {
|
||||
x.split(b"{")[0].decode("ascii"): x.split(b" ")[1].decode("ascii")
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ def run_on_reactor():
|
|||
return make_deferred_yieldable(d)
|
||||
|
||||
|
||||
class CacheTestCase(unittest.TestCase):
|
||||
class DeferredCacheTestCase(unittest.TestCase):
|
||||
def test_invalidate_all(self):
|
||||
cache = descriptors.Cache("testcache")
|
||||
cache = descriptors.DeferredCache("testcache")
|
||||
|
||||
callback_record = [False, False]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue