Giter Site home page Giter Site logo

Comments (3)

hurshi avatar hurshi commented on August 20, 2024

Hi,非常感谢你的提问

  1. 这个拦截器是由 Dio 提供的,只要是同一个 Dio 实例,设置过这个拦截器,之后都会调用这个拦截器;但是调用了拦截器并不意味着就缓存接口了,要对某个接口进行缓存必须显示地调用 options: buildCacheOptions... ,所以这里没有所谓的全局缓存策略,只能为每个接口单独设置。
  2. 和 baseUrl 没有关系,baseUrl 是参数是可选的。对于 dio-http-cache 来说,baseUrl 是 key 的组成部分。
  3. 暂时没有对请求类型做过滤。

其他

  • 全局缓存策略这个功能看上去的确有存在的必要,但我个人觉得也没有那么必要吧,毕竟缓存的接口相对于所有接口一般只是占一小部分,设置了全局缓存后,必须为每个不需要缓存的接口显示地设置跳过缓存。
  • 欢迎提出你的想法,共同交流才能使 dio-http-cache 更好用。

from dio-http-cache.

walkermanx avatar walkermanx commented on August 20, 2024

@hurshi 很感谢你的回复 扫清了我的疑惑 其实目前 dio-http-cache 只是一个单纯的数据缓存库。即实现了强制缓存 并没有完整实现http缓存机制 (比如对比缓存(缓存校验))因此目前我们接口如果返回304状态码应该也是不支持的对吧?

from dio-http-cache.

hurshi avatar hurshi commented on August 20, 2024

对的,的确没有完整实现 http 缓存机制。
但是这里也有初步的实现,比如 maxAge, maxStale 等

from dio-http-cache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.