【问题标题】:Varnish Cached Object Time清漆缓存对象时间
【发布时间】:2014-10-24 20:28:29
【问题描述】:

我们如何在varnish中获取缓存对象的时间。

我的要求是,如果对象在缓存中保存 5 分钟并且对于指定的 ip,我想从后端而不是从缓存中提供内容。

【问题讨论】:

  • TTL参数不适合你需要吗?

标签: varnish varnish-vcl


【解决方案1】:

您可以设置您的 vcl,以便在设置某些标头或请求来自某个浏览器时,它总是会丢失

在你的 vcl_recv 集合中

sub vcl_recv {
if (req.http.Cache-Control ~ "no-cache" && client.ip ~ editors) {
     set req.hash_always_miss = true;
}

}

https://www.varnish-cache.org/trac/wiki/VCLExampleEnableForceRefresh

【讨论】:

    猜你喜欢
    • 2012-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-03
    • 2016-05-25
    • 1970-01-01
    • 2014-04-07
    • 2018-04-07
    相关资源
    最近更新 更多