Remove memcached support
Apparently we had memcached support. It was never worth it, and put a weird md5 hash calculation in the path of regular caching. Seeing as it was completely undocumented, I doubt anyone has ever used it.
This commit is contained in:
@@ -455,8 +455,6 @@ dir but you forgot to put quotes around the directory, since it contains spaces.
|
||||
# Set up the cache objects to use
|
||||
caches = []
|
||||
caches.append(cache.LRUCache(size=100))
|
||||
if config.get("memcached_host", False):
|
||||
caches.append(cache.Memcached(config['memcached_host']))
|
||||
# TODO: optionally more caching layers here
|
||||
|
||||
renders = config['renders']
|
||||
|
||||
@@ -22,7 +22,6 @@ attribute.
|
||||
"""
|
||||
import functools
|
||||
import logging
|
||||
import cPickle
|
||||
|
||||
class LRUCache(object):
|
||||
"""A simple, generic, in-memory LRU cache that implements the standard
|
||||
@@ -137,31 +136,3 @@ class LRUCache(object):
|
||||
d = self.destructor
|
||||
if d:
|
||||
d(link.value)
|
||||
|
||||
# memcached is an option, but unless your IO costs are really high, it just
|
||||
# ends up adding overhead and isn't worth it.
|
||||
try:
|
||||
import memcache
|
||||
except ImportError:
|
||||
class Memcached(object):
|
||||
def __init__(*args):
|
||||
raise ImportError("No module 'memcache' found. Please install python-memcached")
|
||||
else:
|
||||
class Memcached(object):
|
||||
def __init__(self, conn='127.0.0.1:11211'):
|
||||
self.conn = conn
|
||||
self.mc = memcache.Client([conn], debug=0, pickler=cPickle.Pickler, unpickler=cPickle.Unpickler)
|
||||
|
||||
def __getstate__(self):
|
||||
return self.conn
|
||||
def __setstate__(self, conn):
|
||||
self.__init__(conn)
|
||||
|
||||
def __getitem__(self, key):
|
||||
v = self.mc.get(key)
|
||||
if not v:
|
||||
raise KeyError()
|
||||
return v
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
self.mc.set(key, value)
|
||||
|
||||
@@ -103,10 +103,6 @@ outputdir = Setting(required=True, validator=validateOutputDir, default=None)
|
||||
|
||||
processes = Setting(required=True, validator=int, default=-1)
|
||||
|
||||
# memcached is an option, but unless your IO costs are really high, it just
|
||||
# ends up adding overhead and isn't worth it.
|
||||
memcached_host = Setting(required=False, validator=str, default=None)
|
||||
|
||||
# TODO clean up this ugly in sys.argv hack
|
||||
if platform.system() == 'Windows' or not sys.stdout.isatty() or "--simple" in sys.argv:
|
||||
obs = LoggingObserver()
|
||||
|
||||
@@ -731,7 +731,7 @@ class CachedRegionSet(RegionSetWrapper):
|
||||
self.key = s
|
||||
|
||||
def get_chunk(self, x, z):
|
||||
key = hashlib.md5(repr((self.key, x, z))).hexdigest()
|
||||
key = (self.key, x, z)
|
||||
for i, cache in enumerate(self.caches):
|
||||
try:
|
||||
retval = cache[key]
|
||||
|
||||
Reference in New Issue
Block a user