Remove document model cache invalidation
The cache invalidation is now handled by the file caching app. Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -25,10 +25,6 @@ class DocumentManager(models.Manager):
|
||||
self.model, using=self._db
|
||||
).filter(in_trash=False).filter(is_stub=False)
|
||||
|
||||
def invalidate_cache(self):
|
||||
for document in self.model.objects.all():
|
||||
document.invalidate_cache()
|
||||
|
||||
|
||||
class DocumentPageCachedImage(models.Manager):
|
||||
def get_by_natural_key(self, filename, document_page_natural_key):
|
||||
|
||||
@@ -136,10 +136,6 @@ class Document(models.Model):
|
||||
if latest_version:
|
||||
return latest_version.get_api_image_url(*args, **kwargs)
|
||||
|
||||
def invalidate_cache(self):
|
||||
for document_version in self.versions.all():
|
||||
document_version.invalidate_cache()
|
||||
|
||||
@property
|
||||
def is_in_trash(self):
|
||||
return self.in_trash
|
||||
|
||||
@@ -64,7 +64,7 @@ class DocumentPage(models.Model):
|
||||
return partition
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
self.invalidate_cache()
|
||||
self.cache_partition.delete()
|
||||
super(DocumentPage, self).delete(*args, **kwargs)
|
||||
|
||||
def detect_orientation(self):
|
||||
@@ -234,9 +234,6 @@ class DocumentPage(models.Model):
|
||||
)
|
||||
raise
|
||||
|
||||
def invalidate_cache(self):
|
||||
self.cache_partition.purge()
|
||||
|
||||
@property
|
||||
def is_in_trash(self):
|
||||
return self.document.is_in_trash
|
||||
|
||||
@@ -139,6 +139,7 @@ class DocumentVersion(models.Model):
|
||||
page.delete()
|
||||
|
||||
self.file.storage.delete(self.file.name)
|
||||
self.cache_partition.delete()
|
||||
|
||||
return super(DocumentVersion, self).delete(*args, **kwargs)
|
||||
|
||||
@@ -225,11 +226,6 @@ class DocumentVersion(models.Model):
|
||||
return (self.checksum, self.document.natural_key())
|
||||
natural_key.dependencies = ['documents.Document']
|
||||
|
||||
def invalidate_cache(self):
|
||||
self.cache_partition.purge()
|
||||
for page in self.pages.all():
|
||||
page.invalidate_cache()
|
||||
|
||||
@property
|
||||
def is_in_trash(self):
|
||||
return self.document.is_in_trash
|
||||
|
||||
Reference in New Issue
Block a user