Added fix to object.contents cache as well as reworked the extent of cache hooks on location modification.

This commit is contained in:
Griatch 2013-10-21 21:17:32 +02:00
parent 07af616b67
commit 06a0bea8d6
11 changed files with 125 additions and 653 deletions

View file

@ -19,8 +19,6 @@ from src.utils import logger, is_pypy
from django.utils.translation import ugettext as _
__all__ = ["Script", "DoNothing", "CheckSessions", "ValidateScripts", "ValidateChannelHandler"]
if not is_pypy:
__all__.append("ClearAttributeCache")
_SESSIONS = None
_ATTRIBUTE_CACHE_MAXSIZE = settings.ATTRIBUTE_CACHE_MAXSIZE # attr-cache size in MB.
@ -451,19 +449,19 @@ class ValidateChannelHandler(Script):
#print "ValidateChannelHandler run."
channelhandler.CHANNELHANDLER.update()
class ClearAttributeCache(Script):
"Clear the attribute cache."
def at_script_creation(self):
"Setup the script"
self.key = "sys_cache_clear"
self.desc = _("Clears the Attribute Cache")
self.interval = 3600 * 2
self.persistent = True
def at_repeat(self):
"called every 2 hours. Sets a max attr-cache limit to 100 MB." # enough for normal usage?
if is_pypy:
# pypy don't support get_size, so we have to skip out here.
return
attr_cache_size, _, _ = caches.get_cache_sizes()
if attr_cache_size > _ATTRIBUTE_CACHE_MAXSIZE:
caches.flush_attr_cache()
#class ClearAttributeCache(Script):
# "Clear the attribute cache."
# def at_script_creation(self):
# "Setup the script"
# self.key = "sys_cache_clear"
# self.desc = _("Clears the Attribute Cache")
# self.interval = 3600 * 2
# self.persistent = True
# def at_repeat(self):
# "called every 2 hours. Sets a max attr-cache limit to 100 MB." # enough for normal usage?
# if is_pypy:
# # pypy don't support get_size, so we have to skip out here.
# return
# attr_cache_size, _, _ = caches.get_cache_sizes()
# if attr_cache_size > _ATTRIBUTE_CACHE_MAXSIZE:
# caches.flush_attr_cache()