better cache key
This commit is contained in:
parent
b31e73c740
commit
d5b9697c44
1 changed files with 5 additions and 1 deletions
|
@ -44,7 +44,11 @@ def find(data):
|
||||||
if 'group' in q:
|
if 'group' in q:
|
||||||
names = {}
|
names = {}
|
||||||
groups = {}
|
groups = {}
|
||||||
key = 'group:' + hashlib.sha1(json.dumps(data).encode('utf-8')).hexdigest()
|
_keydata = data.copy()
|
||||||
|
for key in ('range', 'position'):
|
||||||
|
if key in _keydata:
|
||||||
|
del _keydata[key]
|
||||||
|
key = 'group:' + hashlib.sha1(json.dumps(_keydata).encode('utf-8')).hexdigest()
|
||||||
g = state.cache.get(key)
|
g = state.cache.get(key)
|
||||||
if g is None:
|
if g is None:
|
||||||
items = q['qs'].options(load_only('id'))
|
items = q['qs'].options(load_only('id'))
|
||||||
|
|
Loading…
Reference in a new issue