Skip to content

Commit

Permalink
Code refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocaccamo committed Nov 3, 2023
1 parent 983d9ac commit 97c83fb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions treenode/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def query_cache(cls, pk=None, pks=None):


def update_cache(cls):
objs = list(cls.objects.all())
ls, d = _get_cached_collections()
ls[cls] = list(cls.objects.all())
d[cls] = {str(obj.pk): obj for obj in ls[cls]}
ls[cls] = objs
d[cls] = {str(obj.pk): obj for obj in objs}
_set_cached_collections(ls, d)

0 comments on commit 97c83fb

Please sign in to comment.