if len(parts) > 1:
limit -= len(parts[1]) + 1
cache_path = parts[0][:limit] + '.' + hashlib.sha1(cache_key.encode('utf-8')).hexdigest()[:8]
if len(parts) > 1:
limit -= len(parts[1]) + 1
cache_path = parts[0][:limit] + '.' + hashlib.sha1(cache_key.encode('utf-8')).hexdigest()[:8]