mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Added FlushCache cronjob, also fixed output message for ClearStaleCache
This commit is contained in:
@@ -16,5 +16,22 @@ class ClearStaleCache():
|
||||
|
||||
def job(self):
|
||||
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()
|
||||
|
||||
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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user