Cache query for author's books

This commit is contained in:
Mouse Reeve
2022-01-17 11:53:00 -08:00
parent 8e1352fb75
commit 4cc35ba25e
2 changed files with 21 additions and 5 deletions

View File

@ -342,6 +342,11 @@ class Edition(Book):
# set rank
self.edition_rank = self.get_rank()
# clear author cache
if self.id:
for author_id in self.authors.values_list("id", flat=True):
cache.delete(f"author-books-{author_id}")
return super().save(*args, **kwargs)
@classmethod