0

added a memcached option. It's really slow though. don't use it.

This commit is contained in:
Andrew Brown
2012-03-04 22:25:38 -05:00
parent d1f53cc910
commit 98c23fd970
4 changed files with 38 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ import os
import os.path
from glob import glob
import logging
import hashlib
import numpy
@@ -581,14 +582,13 @@ class CachedRegionSet(RegionSetWrapper):
s += obj.regiondir
logging.debug("Initializing a cache with key '%s'", s)
if len(s) > 32:
import hashlib
s = hashlib.md5(s).hexdigest()
s = hashlib.md5(s).hexdigest()
self.key = s
def get_chunk(self, x, z):
key = (self.key, x, z)
key = hashlib.md5(repr((self.key, x, z))).hexdigest()
for i, cache in enumerate(self.caches):
try:
retval = cache[key]