On Sat, May 26, 2012 at 3:37 PM, DF <donfernan...@gmail.com> wrote: > A TemplateSyntaxError error has occurred in my previously functional project > and after trying for hours to resolve it, it was determined it might be a > cache error and to empty the tmp directory at the root (the template had > been working fine for a week and nothing was changed that might have > affected it). > > I've searched online and can't seem to find a safe means of performing this. > I don't want to inadvertently remove any essential information. If anyone > knows how to perform this safely, it would be much appreciated. > > I found this but not sure if it's safe: > > $ python manage.py shell > >>>> from django.core.cache import cache >>>> cache.clear()
Whether this is "safe" will depend entirely on what else is in your cache. cache.clear() dumps the full contents of your cache; if you're using memcache, it's essentially the same as restarting memcache, but without the service downtime. The other way is to determine the specific cache key that you need to flush, and delete that specific key (or keys) with cache.delete('your_key_here'). This is one of the reasons that Django allows you to maintain multiple cache backends. If you've got multiple types of information to cache, having them all in the same cache means that if you call flush, you lose *everything*; if you run multiple memcached instances, and use Django's multiple cache backed interface to access them, you can isolate the different types of cached information, and a flush will be limited to contents of the specific cache. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.