CassandraCacheChain: memcache is always present.

This commit is contained in:
Brian Simpson
2015-02-18 01:44:06 -05:00
parent 2836d01ee4
commit b58f8ab7b6
2 changed files with 8 additions and 17 deletions

View File

@@ -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.

View File

@@ -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