Added cache-cleaning to the idmapper base class. This works to sync most changes from the admin site-side, but not location changes (which leaves the content cache stale). Thinking of testing the django in-built cache framework instead, maybe using custom fields?

This commit is contained in:
Griatch 2013-05-25 10:20:26 +02:00
parent 0a39b8f65e
commit deafb9c544
3 changed files with 28 additions and 4 deletions

View file

@ -28,6 +28,7 @@ except ImportError:
from django.db import transaction
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.contenttypes.models import ContentType
from src.server.models import ServerConfig
from src.utils.utils import to_str, uses_database
from src.utils import logger

View file

@ -210,6 +210,8 @@ def update_cached_instance(sender, instance, **kwargs):
if not hasattr(instance, 'cache_instance'):
return
sender.cache_instance(instance)
from src.server.caches import flush_obj_caches
flush_obj_caches(instance)
post_save.connect(update_cached_instance)
def cache_size(mb=True):