gpt4 book ai didi

.net - OutputCache 为长期陈旧数据提供服务

转载 作者:行者123 更新时间:2023-12-04 02:10:45 25 4
gpt4 key购买 nike

我很困惑... re thisthis “元”问题...

一个非常基本的http请求:

GET http://stackoverflow.com/feeds/tag?tagnames=c%23&sort=newest HTTP/1.1
Host: stackoverflow.com
Accept-Encoding: gzip,deflate

它击中了一条装饰有:
[OutputCache(Duration = 300, VaryByParam = "tagnames;sort",
VaryByContentEncoding = "gzip;deflate", VaryByCustom = "site")]

是反复 和错误 如果您包含 if-modified-since 或 200 的旧数据,则提供 304(无变化),即
HTTP/1.1 200 OK
Cache-Control: public, max-age=0
Content-Type: application/atom+xml; charset=utf-8
Content-Encoding: gzip
Expires: Fri, 01 Jul 2011 09:17:08 GMT
Last-Modified: Fri, 01 Jul 2011 09:12:08 GMT
Vary: *
Date: Fri, 01 Jul 2011 09:42:46 GMT
Content-Length: 14714
(payload, when decoded = some long-stale data)

如您所见,它在 5 分钟时段后提供近半小时服务;看起来 OutputCache 的内部根本没有注意到时间 ;p 它最终会过期(事实上,它刚刚这样做了 - 我的 Fri, 01 Jul 2011 09:56:20 GMT 请求终于获得了新数据),但不是准时。

更新:

我相信如果我们去掉接受编码头,它会起作用,但不是;这也失败了 - 它只是在不同的循环中失败(这是我们应该期待的,因为 key 不同,由 VaryByContentEncoding 提供):
GET http://stackoverflow.com/feeds/tag?tagnames=c%23&sort=newest HTTP/1.1
Host: stackoverflow.com

给出:
HTTP/1.1 200 OK
Cache-Control: public, max-age=0
Content-Type: application/atom+xml; charset=utf-8
Expires: Fri, 01 Jul 2011 10:09:58 GMT
Last-Modified: Fri, 01 Jul 2011 10:04:58 GMT
Vary: *
Date: Fri, 01 Jul 2011 10:17:20 GMT
Content-Length: 66815
(payload = some stale data)

再一次,您会注意到它是在 Expires 之后提供的。 .

所以:这里可能有什么问题?

额外的;当我们使用自定义选项时,我们的 GetVaryByCustomString()正确调用 base.GetVaryByCustomString(ctx, custom)对于它无法识别的选项,根据 MSDN (确实,这对于上面的第二个示例工作正常)。

最佳答案

您是否有机会使用自定义输出缓存提供程序?假设,如果有一个自定义提供程序使用滑动过期而不是绝对过期,您会看到这样的症状。

关于.net - OutputCache 为长期陈旧数据提供服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6546444/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com