ASP.NET:在哪里/如何web.config中缓存?

编程入门 行业动态 更新时间:2024-10-22 10:40:57
本文介绍了ASP.NET:在哪里/如何web.config中缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的ASP.NET的 web.config中的内容缓存在微软的文档在读的地方。如果这是真的,其中,是它的缓存 - 在内存或磁盘上

I read somewhere in the Microsoft documentation that the content of the ASP.NET's web.config is cached. If that is true, where is it cached - in memory or on disk?

和后续的问题:是否有任何性能考虑,我必须作出,如果我要深入访问该web.config中

And a follow-up question: are there any performance considerations I have to make, if I have to access the web.config intensively?

推荐答案

其缓存在内存中,磁盘高速缓存没有任何意义,它已经在磁盘上。

Its cached in memory, caching on disk doesn't make any sense, its already on disk.

所有ASP.NET要确保通过HttpContext对象的 GetSection 方法访问配置节的第一个(这使用由ASP.NET管理缓存副本)。

First of all in ASP.NET you want to ensure you access configuration sections through the HttpContext object's GetSection method (this uses the cached copies managed by ASP.NET).

访问配置值的性能是内部实现的部分对象(通过GetSection返回的对象)的函数。 A 配置节可能只是作为包装器,它可以在属性每个请求读取DOM节点。 OTH它可以internaly缓存的价值和观赏更改。

Performance of accessing config values is a function of the internal implementation of the Section object (the object returned by GetSection). A ConfigurationSection may simply act as wrapper for a DOM node which it may read on every request for a property. OTH it could internaly cache the value and watch for changes.

我的建议是保持你的code简单,只是通过 GetSection 访问所需的值,而不是试图在其他地方举行他们的副本,但通过各种手段维护通过 GetSection 的请求期间返回的对象的引用,如果你打算从它取多个值。

My advice would be keep your code simple and just access the values you need via GetSection rather than attempt to hold copies of them elsewhere but by all means maintain a reference to the object returned by GetSection for the duration of a request if you are going to fetch multiple values from it.

更多推荐

ASP.NET:在哪里/如何web.config中缓存?

本文发布于:2023-11-14 10:08:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586927.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缓存   NET   ASP   config   web

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!