diff --git a/r2/r2/lib/app_globals.py b/r2/r2/lib/app_globals.py index 6bfbc49f0..2a5a65da3 100644 --- a/r2/r2/lib/app_globals.py +++ b/r2/r2/lib/app_globals.py @@ -618,12 +618,10 @@ class Globals(object): # memcaches used in front of the permacache CF in cassandra. # XXX: this is a legacy thing; permacache was made when C* didn't have # a row cache. - if self.permacache_memcaches: - permacache_memcaches = CMemcache(self.permacache_memcaches, - min_compress_len=50 * 1024, - num_clients=num_mc_clients) - else: - permacache_memcaches = None + permacache_memcaches = CMemcache("perma", + self.permacache_memcaches, + min_compress_len=50 * 1024, + num_clients=num_mc_clients) # the stalecache is a memcached local to the current app server used # for data that's frequently fetched but doesn't need to be fresh. diff --git a/r2/r2/lib/cache.py b/r2/r2/lib/cache.py index cf0a5e0b9..d3fdf9643 100644 --- a/r2/r2/lib/cache.py +++ b/r2/r2/lib/cache.py @@ -781,12 +781,8 @@ CL_QUORUM = ConsistencyLevel.QUORUM CL_ALL = ConsistencyLevel.ALL class CassandraCacheChain(CacheChain): - def __init__(self, localcache, cassa, lock_factory, memcache=None, **kw): - if memcache: - caches = (localcache, memcache, cassa) - else: - caches = (localcache, cassa) - + def __init__(self, localcache, cassa, lock_factory, memcache, **kw): + caches = (localcache, memcache, cassa) self.cassa = cassa self.memcache = memcache self.make_lock = lock_factory @@ -810,12 +806,9 @@ class CassandraCacheChain(CacheChain): rcl = wcl = self.cassa.write_consistency_level if willread: try: - value = None - if self.memcache: - value = self.memcache.get(key) + value = self.memcache.get(key) if value is None: - value = self.cassa.get(key, - read_consistency_level = rcl) + value = self.cassa.get(key, read_consistency_level=rcl) except CassandraNotFound: value = default