gpt4 book ai didi

asp.net-core - 我需要在 ASP.NET Core 中调用 AddMemoryCache 才能让缓存工作吗?

转载 作者:行者123 更新时间:2023-12-04 15:08:11 25 4
gpt4 key购买 nike

在最新的 .net Core (1.0.0-preview2-003131) 中,我对启动的服务及其默认值感到困惑。

具体来说,我注意到在一个新的核心 Web 项目中,调用了 AddMvc() 但没有调用 Add AddMemoryCache()(两者似乎都可用于应用程序)。更进一步,似乎在帮助文档中:https://docs.microsoft.com/en-us/aspnet/core/performance/caching/memory它显示了 AddMemoryCache。

AddMemoryCache() 是否以某种方式在其他地方加载?如果没有,如果没有添加服务,为什么缓存似乎可以工作?

最佳答案

Does AddMemoryCache() somehow get loaded someplace else?



是的。调用 services.AddMvc()时间接添加的,因为它在 tag helpers stack 中使用.

关于asp.net-core - 我需要在 ASP.NET Core 中调用 AddMemoryCache 才能让缓存工作吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41879265/

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