简体   繁体   English

为什么我存储在缓存中的数据已在asp.net中删除

[英]why data i stored in cache has been removed in asp.net

I decided to store my data for example List of country, state, city, book and other data in cache for speed of my web site but I found that when the cache item count is 10 and Cache.EffectivePercentagePhysicalMemoryLimit is 98 I add my data to cache but other data will remove. 我决定将我的数据(例如国家,州,城市,书籍和其他数据的列表)存储在缓存中以提高网站的速度,但是我发现当缓存项计数为10且Cache.EffectivePercentagePhysicalMemoryLimit为98时,我将数据添加到缓存,但其他数据将被删除。

I set cache expiration to 20 min.how should I set size of cache? 我将缓存过期时间设置为20分钟。如何设置缓存大小? how should I do with this problem? 我该怎么办? why data I stored in cache has been removed in asp.net 为什么我存储在缓存中的数据已在asp.net中删除

in below code I have set a breakpoint the method return an empty list and when I check other data like country and state they have been removed from cache 在下面的代码中,我设置了一个断点,该方法返回一个空列表,当我检查其他数据(如国家和地区)时,它们已从缓存中删除

var cahpters= CacheData.Data.Chapter.list(bookid.ToString());

why data i stored in cache has been removed in asp.net 为什么我存储在缓存中的数据已在asp.net中删除

Objects can be explicitly taken out of the cache when: 在以下情况下,可以将对象明确从缓存中取出:

  • Explicitly by calling Remove 明确地通过调用Remove
  • Data expiration 数据到期
  • Memory consumption 内存消耗
    • Low priority cache data will be removed first 低优先级缓存数据将首先被删除

Most probably in your case you have huge memory consumption so ASP.NET decided to save memory by removing you item from the cache. 在您的情况下,很可能您会消耗大量内存,因此ASP.NET决定通过从缓存中删除项目来节省内存。

Also you can register for removal notification (including the reason). 也可以注册删除通知 (包括原因)。 See more about that here: https://msdn.microsoft.com/en-us/library/7kxdx246%28v=vs.140%29.aspx 在此处查看有关此内容的更多信息: https : //msdn.microsoft.com/zh-cn/library/7kxdx246%28v=vs.140%29.aspx

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 自长时间的操作开始以来就很难确定ASP.Net中的数据缓存是否已更改 - Challenging to determine if Cache for data has been changed in ASP.Net since a long operation began 如何将现有菜单项添加回已删除的ASP.NET C# - How To Add An Existing Menu Item Back Once It Has Been Removed ASP.NET C# ASP.NET Web窗体-部署到Azure-“您正在寻找的资源已被删除或暂时不可用。” - ASP.NET Web Forms - Deploying to Azure - “The resource you are looking for has been removed or is temporarily unavailable.” HttpResponseMessage的通用版本是否已从ASP.NET WebApi中删除? - Has the generic version of HttpResponseMessage been removed from the ASP.NET WebApi? asp.net网站-是否可以预编译? - asp.net website - Can I tell if it has been precompiled? 尝试使用EntityFramework保存已存储在ASP.NET控件状态的实体 - Trying to save an entity that has been stored in ASP.NET control state using EntityFramework 现在已删除了identityconfig.cs,在ASP.NET 5.0 MVC Identity中定义密码验证的正确位置在哪里? - Where is the correct place to define password validation in ASP.NET 5.0 MVC Identity now identityconfig.cs has been removed? (ASP.NET缓存API)是否有可能在项目的设置到期之前将其从缓存中删除? - (ASP.NET Cache API) Is it possible that an item may be removed from cache before its set expiry? ASP.NET-填写字段并单击按钮后,将数据插入SQL Server数据库吗? - ASP.NET - Insert data into an SQL server database when a field has been filled in and a button clicked? 为什么从查询字符串中删除了反斜杠 - ASP.NET和Javascript - Why are backward slashes removed from querystring - ASP.NET & Javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM