Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handleRequestCache 缓存策略:是否只缓存状态为 200 的请求,而不是 [200, 400) #630

Open
AmosJin opened this issue Mar 22, 2019 · 1 comment
Assignees

Comments

@AmosJin
Copy link

AmosJin commented Mar 22, 2019

场景:使用 sdk.lift() 接口,如果其中 request 是个返回状态为 204 的请求,那么这个 handleRequestCache 中的缓存策略是缓存的(因为它本身不关心是否是个请求,只要请求状态是 [200, 400) 就表示成功,然后 do(() => this.requestMap.set(cacheKey, true)) 缓存。
疑问:是否考虑只有 200 的才 do(() => this.requestMap.set(cacheKey, true))?

@chuan6
Copy link
Contributor

chuan6 commented Mar 25, 2019

@AmosJin 谢谢!我们私下讨论一下具体场景吧,因为理论上 204 返回状态一般对应更改型的 HTTP 方法,如 PUT/PATCH,而我们使用缓存策略的代码分支只针对 GET 有效,两者不应该有交互 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants