Skip to content
Browse files

models.py: thread-safe cachedGeneratorG second attempt

  • Loading branch information...
1 parent d6cf1c3 commit 224ec51edc57b13e410753bc66094da840f242bb @trey0 trey0 committed Oct 4, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 geocamTiePoint/models.py
View
4 geocamTiePoint/models.py
@@ -38,7 +38,6 @@
# use the memcached cache, but that would get rid of much of the benefit
# in terms of serialization/deserialization.
cachedGeneratorG = threading.local()
-cachedGeneratorG.gen = {'key': None, 'value': None}
def getNewImageFileName(instance, filename):
@@ -152,7 +151,8 @@ def getGeneratorCacheKey(cls, quadTreeId):
@classmethod
def getGeneratorWithCache(cls, quadTreeId):
global cachedGeneratorG
- cachedGeneratorCopy = cachedGeneratorG.gen
+ cachedGeneratorCopy = getattr(cachedGeneratorG, 'gen',
+ {'key': None, 'value': None})
key = cls.getGeneratorCacheKey(quadTreeId)
if cachedGeneratorCopy['key'] == key:
logging.debug('getGeneratorWithCache hit %s', key)

0 comments on commit 224ec51

Please sign in to comment.
Something went wrong with that request. Please try again.