url.el 自带的 Cache 机制

url.el 自带一个简单的 Cache 机制,当用户通过 url-automatic-caching 启动自动 Cache 之后,GET 请求的返回会自动保存到一个文件中,有效期为一个小时,一小时内如果用户再次访问同一个 URL,url.el 会发送 If-Modified-Since HTTP Header,如果服务器返回 304 Not Modified 则使用本地的 Cache。

可惜的是 url.el 不支持 Cache-Control,服务器返回 Cache-Control: max-age=120 的话,客户端应该能在 2 分钟内不用请求服务器。

1 个赞