mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
CassandraCacheChain: memcache is always present.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user