ASP.NET:在哪里/如何web.config中缓存? [英] ASP.NET: Where/how is web.config cached?

查看:103
本文介绍了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中缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆