only cache to localstorage if cacheKey is specified