diff --git a/r2/example.ini b/r2/example.ini index cc68e4bab..6b4d283c2 100644 --- a/r2/example.ini +++ b/r2/example.ini @@ -466,6 +466,8 @@ relcaches = 127.0.0.1:11211 stalecaches = # cache for tracking rate limit thresholds ratelimitcaches = 127.0.0.1:11211 +# hosts to store hardcache data +hardcache_memcaches = 127.0.0.1:11211 ############################################ MISCELLANEOUS diff --git a/r2/r2/lib/app_globals.py b/r2/r2/lib/app_globals.py index 13e48d746..db1f69d20 100644 --- a/r2/r2/lib/app_globals.py +++ b/r2/r2/lib/app_globals.py @@ -259,6 +259,7 @@ class Globals(object): 'srmembercaches', 'relcaches', 'ratelimitcaches', + 'hardcache_memcaches', 'cassandra_seeds', 'automatic_reddits', 'hardcache_categories', @@ -740,6 +741,16 @@ class Globals(object): validators=[], ) + # hardcache memcache pool + hardcache_memcaches = CMemcache( + "hardcache", + self.hardcache_memcaches, + binary=True, + min_compress_len=1400, + num_clients=num_mc_clients, + validators=[validate_size_error], + ) + self.startup_timer.intermediate("memcache") ################# CASSANDRA @@ -863,7 +874,7 @@ class Globals(object): # hardcache is used for various things that tend to expire # TODO: replace hardcache w/ cassandra stuff self.hardcache = HardcacheChain( - (localcache_cls(), memcaches, HardCache(self)), + (localcache_cls(), hardcache_memcaches, HardCache(self)), cache_negative_results=True, ) cache_chains.update(hardcache=self.hardcache)