Add more uncache points to help with stale data

master
voussoir 2017-05-01 21:16:10 -07:00
parent 8080d92f8d
commit 83b9adbd61
1 changed files with 4 additions and 0 deletions

View File

@ -85,6 +85,7 @@ class GroupableMixin:
'INSERT INTO %s VALUES(?, ?)' % self.group_table, 'INSERT INTO %s VALUES(?, ?)' % self.group_table,
[self.id, member.id] [self.id, member.id]
) )
self._uncache()
if commit: if commit:
self.photodb.log.debug('Committing - add to group') self.photodb.log.debug('Committing - add to group')
self.photodb.commit() self.photodb.commit()
@ -149,6 +150,7 @@ class GroupableMixin:
'DELETE FROM %s WHERE memberid == ?' % self.group_table, 'DELETE FROM %s WHERE memberid == ?' % self.group_table,
[self.id] [self.id]
) )
self._uncache()
if commit: if commit:
self.photodb.log.debug('Committing - delete tag') self.photodb.log.debug('Committing - delete tag')
self.photodb.commit() self.photodb.commit()
@ -195,6 +197,7 @@ class GroupableMixin:
'DELETE FROM %s WHERE memberid == ?' % self.group_table, 'DELETE FROM %s WHERE memberid == ?' % self.group_table,
[self.id] [self.id]
) )
self._uncache()
if commit: if commit:
self.photodb.log.debug('Committing - leave group') self.photodb.log.debug('Committing - leave group')
self.photodb.commit() self.photodb.commit()
@ -968,6 +971,7 @@ class Tag(ObjectBase, GroupableMixin):
def _uncache(self): def _uncache(self):
self.photodb.caches['tag'].remove(self.id) self.photodb.caches['tag'].remove(self.id)
self._cached_qualified_name = None
@decorators.transaction @decorators.transaction
def add_synonym(self, synname, *, commit=True): def add_synonym(self, synname, *, commit=True):