clear all cached sizes

This commit is contained in:
j 2016-01-16 10:47:52 +05:30
commit b899768130
4 changed files with 39 additions and 22 deletions

View file

@ -82,6 +82,15 @@ class Icons(dict):
c.close()
conn.close()
def clear(self, prefix):
sql = 'DELETE FROM icon WHERE id LIKE ?'
conn = self.connect()
c = conn.cursor()
c.execute(sql, (prefix + '%', ))
conn.commit()
c.close()
conn.close()
icons = Icons(icons_db_path)
@run_async
@ -122,9 +131,7 @@ def get_icon(id, type_, size, callback):
callback(data)
def clear_default_cover_cache():
for resolution in (64, 128, 256, 512, 1024):
key = '%s:%s:%s' % ('default', 'cover', resolution)
del icons[key]
icons.clear('default:cover:')
@run_async
def get_icon_app(id, type_, size, callback):