fix group cache
This commit is contained in:
parent
6d659b8049
commit
0a4689387b
3 changed files with 8 additions and 3 deletions
|
@ -23,3 +23,8 @@ class Cache(dict):
|
|||
if key in self._added:
|
||||
del self._added[key]
|
||||
del self[key]
|
||||
|
||||
def clear(self, prefix):
|
||||
for key in list(self):
|
||||
if key.startswith(prefix):
|
||||
self.delete(key)
|
||||
|
|
|
@ -140,9 +140,7 @@ def edit(data):
|
|||
if len(ids) > 1:
|
||||
response = data
|
||||
response['id'] = edited
|
||||
for key in list(state.cache):
|
||||
if key.startswith('group:'):
|
||||
state.cache.delete(key)
|
||||
state.cache.clear('group:')
|
||||
return response
|
||||
actions.register(edit, cache=False)
|
||||
|
||||
|
|
|
@ -233,6 +233,7 @@ def addListItems(data):
|
|||
l = models.List.get_or_create(data['list'])
|
||||
if l:
|
||||
l.add_items(data['items'])
|
||||
state.cache.clear('group:')
|
||||
return l.json()
|
||||
return {}
|
||||
actions.register(addListItems, cache=False)
|
||||
|
@ -248,6 +249,7 @@ def removeListItems(data):
|
|||
l = models.List.get(data['list'])
|
||||
if l:
|
||||
l.remove_items(data['items'])
|
||||
state.cache.clear('group:')
|
||||
return l.json()
|
||||
return {}
|
||||
actions.register(removeListItems, cache=False)
|
||||
|
|
Loading…
Reference in a new issue