better cache key

This commit is contained in:
j 2016-01-22 13:54:58 +05:30
parent b31e73c740
commit d5b9697c44
1 changed files with 5 additions and 1 deletions

View File

@ -44,7 +44,11 @@ def find(data):
if 'group' in q:
names = {}
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)
if g is None:
items = q['qs'].options(load_only('id'))