mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Speedup the cache clear job by using some sensible code options
This commit is contained in:
@@ -16,7 +16,7 @@ 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' % len(objs))
|
self._logger.info('Removing %s stale cache documents' % objs.count())
|
||||||
objs.delete()
|
objs.delete()
|
||||||
|
|
||||||
class FlushCache():
|
class FlushCache():
|
||||||
@@ -32,6 +32,6 @@ class FlushCache():
|
|||||||
|
|
||||||
def job(self):
|
def job(self):
|
||||||
objs = CachedDocument.objects.all()
|
objs = CachedDocument.objects.all()
|
||||||
self._logger.info('Removing %s stale cache documents' % len(objs))
|
self._logger.info('Removing %s stale cache documents' % objs.count())
|
||||||
objs.delete()
|
objs.delete()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user