我对apollo cachepersitor感到困惑,即使遵循了apollos官方教程和关于stackoverflow的建议(表明我包括maxSize),我仍然收到本地存储已满的错误。错误仍然存在,并且无法应用maxSize规则。
const persistor = new CachePersistor({
cache,
storage: window.localStorage,
maxSize: 1900000,
debug: true,
})
调试显示缓存继续存在
[apollo-cache-persist] Persisted cache of size 65416
[apollo-cache-persist] Persisted cache of size 68471
[apollo-cache-persist] Persisted cache of size 1178469
[apollo-cache-persist] Purged cache storage
[apollo-cache-persist] Persisted cache of size 2556195
[apollo-cache-persist] Purged cache storage
[apollo-cache-persist] Persisted cache of size 2702136
[apollo-cache-persist] Purged cache storage
[apollo-cache-persist] Persisted cache of size 3448243
[apollo-cache-persist] Purged cache storage vendor.js:139549
然后我从本地存储超过chrome配额的地方得到了错误belwo。
apollo-cache-persist] Error persisting cache DOMException: Failed to execute 'setItem' on 'Storage': Setting the value of 'apollo-cache-persist' exceeded the quota.
我们将竭诚欢迎所有帮助。