ASP.NET数据缓存 - 应用程序域重新启动后,preserve内容 [英] ASP.NET Data Cache - preserve contents after app domain restart

查看:330
本文介绍了ASP.NET数据缓存 - 应用程序域重新启动后,preserve内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ASP.NET的数据缓存API。例如:

  HttpRuntime.Cache.Insert(my_data,my_key);

有什么办法来配置缓存,这样它的内容是preserved当应用程序域回收?

我加载许多对象到缓存中,但有一个实质性的延迟重新加载这些每次应用程序域重新启动。承担这个问题,我不能prevent的AppDomain重新启动因服务器配置。


解决方案

  

有什么办法来配置缓存,这样
  其内容是preserved当
  应用程序域回收?


没有。 Cache对象持有RAM引用。期。

替代:


  1. 外的进程外会话状态(虽然这是每个用户)

  2. 分布式缓存

  3. 使用SQL Server作为一个高速缓存(如果它使数据在内存中,而不是在磁盘上)

  4. 写的对象磁盘在web层

我一般$ P $#PFER自己3,虽然有场景中的人是合适的。

I am using ASP.NET's data caching API. For example:

HttpRuntime.Cache.Insert(my_data, my_key);

Is there any way to configure cache so its contents are preserved when the App Domain recycles?

I load many object into cache, but there is a substantial delay re-loading these every time the app domain restarts. Assume for this question that I can't prevent the appdomain restart due to a server configuration.

解决方案

Is there any way to configure cache so its contents are preserved when the App Domain recycles?

No. The Cache object holds references in RAM. Period.

Alternatives:

  1. Out-of-process Session state (although that's per-user)
  2. Distributed cache
  3. Use SQL Server as a cache (where it keeps data in memory, rather than on disk)
  4. Write the objects to disk at the web tier

I generally prefer #3 myself, although there are scenarios where the others are appropriate.

这篇关于ASP.NET数据缓存 - 应用程序域重新启动后,preserve内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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