ASP.NET MVC 控制器操作中的 OutputCache 键格式

Mik*_*ynn -1 .net c# asp.net-mvc caching outputcache

控制器操作上输出缓存的确切密钥格式是什么?

[OutputCache(CacheProfile = "Games")]
public virtual ActionResult EventGames(int? id, string slug)
Run Code Online (Sandbox Code Playgroud)

Tru*_* Le 5

我想不出任何需要使用 OutputCache 键的情况。

无论如何,密钥是使用以下因素生成的:
- 密钥前缀,由 OutputCacheAttribute 类预定义。
- 控制器动作的 uniqueId。
- VaryByCustom 参数。
- VaryByParam 参数。

这些因素将被连接起来,然后使用SHA256Cng进行散列

详细实现可以在这里找到:OutputCacheAttribute.cs