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

FIX: When 'request.baseUrl' changed, the cache is still valid. #314

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dxxxp
Copy link

@dxxxp dxxxp commented Feb 24, 2017

子类重写的baseUrl方法返回值变化时,缓存未失效。
场景:测试环境和生产环境切换

@Huang-Libo
Copy link
Contributor

Huang-Libo commented Feb 24, 2017

@SeveX
baseUrl 为什么不直接用 sharedConfig 设置, 想在测试环境和生产环境之间切换的时候直接修改 sharedConfig 的设置就可以了, 写到子类中反而让事情变复杂了

@dxxxp
Copy link
Author

dxxxp commented Feb 24, 2017

后端有多套系统,多个域名。唉,说多了全是泪。。。

@Huang-Libo
Copy link
Contributor

那要切环境的话, 也只能同时使用一个环境吧, 如果个别接口需要使用另一个环境, 直接在子类的 requestUrl 方法里写完整的url即可.

@lancy
Copy link
Member

lancy commented Feb 24, 2017

@skyline75489 感觉这里的确有问题:

理论上为了保证缓存唯一命中,应该以最终 build 出来 url 为 key,不单是拼接 baseUrl,还有 urlFilters 按说也应当算作缓存的一部分;
不过有一些特例 urlFilters 又应当排除在外,比如 全局参数 和 随时间变化的 token;

@skyline75489
Copy link
Contributor

确实这里考虑的不是特别全面,有改善空间

Copy link
Member

@lancy lancy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我感觉可以合并;
麻烦修改一下 commit message 添加 FIX: 以符合项目惯;

@dxxxp dxxxp changed the title When 'request.baseUrl' changed, the cache is still valid. FIX: When 'request.baseUrl' changed, the cache is still valid. Sep 18, 2017
@anru1314
Copy link

@SheikahPlate 大兄弟 ,多个域名,有啥比较好的解决方式?

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

Successfully merging this pull request may close these issues.

5 participants