Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nick2k5 committed Aug 29, 2011
1 parent deb1179 commit f74cdb7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions memcached_property.py
Expand Up @@ -3,7 +3,7 @@
from plum.settings import ALLOW_CACHING, CACHE_TIMEOUT
except ImportError:
ALLOW_CACHING = True
CACHE_TIMEOUT = 60
CACHE_TIMEOUT = 300

class MemcachedClass(object):
#_ckey_uid_name = 'ckey_uid'
Expand Down Expand Up @@ -42,9 +42,11 @@ def __get__(self, obj, klass=None):
value = self.fget(obj)
else:
value = cache.get(self._ckey(obj))
if not value:
if value == None:
#print 'cache MISS %s ' % self._ckey(obj)
value = self.fget(obj)
else:
#print 'cache HIT %s: ' % self._ckey(obj)
pass
self._save_to_cache(obj, value)
return value
Expand All @@ -65,6 +67,8 @@ def _ckey(self, obj):
def _save_to_cache(self, obj, value):
if not self.dont_cache and ALLOW_CACHING:
cache.set(self._ckey(obj), value, CACHE_TIMEOUT)
#print cache.get(self._ckey(obj))
#print 'eval to %s' % (cache.get(self._ckey(obj)) or "THIS")
return True
return False

Expand Down

0 comments on commit f74cdb7

Please sign in to comment.