Added FlushCache cronjob, also fixed output message for ClearStaleCache

This commit is contained in:
2010-06-04 09:00:51 +01:00
parent 61793f8ec7
commit 7e094f3a37

View File

@@ -16,5 +16,22 @@ class ClearStaleCache():
def job(self): def job(self):
objs = CachedDocument.objects.filter(cached_until__lt=datetime.utcnow()) objs = CachedDocument.objects.filter(cached_until__lt=datetime.utcnow())
self._logger.info('Removing %s stale cache documents') self._logger.info('Removing %s stale cache documents' % len(objs))
objs.delete() objs.delete()
class FlushCache():
"""
Flushes the entire cache
"""
@property
def _logger(self):
if not hasattr(self, '__logger'):
self.__logger = logging.getLogger(__name__)
return self.__logger
def job(self):
objs = CachedDocument.objects.all()
self._logger.info('Removing %s stale cache documents' % len(objs))
objs.delete()