clear cover/preview cache on delete
This commit is contained in:
parent
1d6e94d1a6
commit
59894b0df7
1 changed files with 4 additions and 2 deletions
|
@ -255,6 +255,8 @@ class Item(db.Model):
|
|||
Transfer.query.filter_by(item_id=self.id).delete()
|
||||
Scrape.query.filter_by(item_id=self.id).delete()
|
||||
state.db.session.delete(self)
|
||||
icons.clear('cover:%s' % self.id)
|
||||
icons.clear('preview:%s' % self.id)
|
||||
if commit:
|
||||
state.db.session.commit()
|
||||
|
||||
|
@ -330,7 +332,7 @@ class Item(db.Model):
|
|||
self.info['coverRatio'] = self.info['previewRatio']
|
||||
elif 'coverRatio' in self.info:
|
||||
del self.info['coverRatio']
|
||||
icons.clear('cover:%s:'%self.id)
|
||||
icons.clear('cover:%s:' % self.id)
|
||||
|
||||
def update_preview(self):
|
||||
key = 'preview:%s'%self.id
|
||||
|
@ -349,7 +351,7 @@ class Item(db.Model):
|
|||
self.info['previewRatio'] = self.info['coverRatio']
|
||||
elif 'previewRatio' in self.info:
|
||||
del self.info['previewRatio']
|
||||
icons.clear('preview:%s:'%self.id)
|
||||
icons.clear('preview:%s:' % self.id)
|
||||
|
||||
def update_icons(self):
|
||||
self.update_cover()
|
||||
|
|
Loading…
Reference in a new issue