Asp.net缓存或手动缓存 [英] Asp.net cache or manual caching

查看:69
本文介绍了Asp.net缓存或手动缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要从其他网站缓存一些RSS数据到我的服务器,并每10分钟更新一次缓存。
我应该在数据库或文件中使用Asp.net system.web.caching还是缓存?

I'm going to cache some RSS data from other websites to my server and update caches every 10 minutes. Should I use Asp.net system.web.caching or cache in database or file?

PS:当用户在客户端应用程序上请求供稿时,我的服务器从服务器下载它。在接下来的10分钟内,如果另一个用户请求该供稿,则我的服务器会从缓存中加载该供稿。
可能有100个以上的提要...

P.S: when a user requests a feed on my client application, my server downloads it from server. And in the next 10 minutes, if another user requests that feed, my server loads it from cache. There may be for than 100 feeds...

推荐答案

使用自定义数据库缓存的原因是:

The reason to go with custom database cache are:


  1. 更多有关缓存过期时间和方式的控制

  2. 数据太多(超过10Mg )*

  3. 需要将它们保留太多的时间(几天或几个月)*

  4. 访问后面的代码上的缓存数据(出于任何原因) )

  1. More control on how and when the cache expire
  2. The data are too many (more than 10Mg) *
  3. Need to keep them for too much time (days or months) *
  4. Access to the cache data on code behind (for any reason)

在您的情况下,您只需要使它过期即可,我认为数据量很小(小于10Mg),并且您可以保留它持续10分钟,因此请使用asp.net缓存,因为它位于iis的核心,因此速度更快,并且根本不进行任何代码的重播。

In your case, you only need to expire it soon, I think the data are small (less than 10Mg) and you keep it for 10 minutes, so go with asp.net cache that is faster because is lives in the core of the iis, and replays with out go to your code at all.

[*]我说这是因为asp.net缓存保留在内存中,但是您的自定义缓存保存在数据库中,因此可以在其中生存更长的时间,而且可能很大。

[*] I say that because the asp.net cache are keeped on the memory, but your custom cache are saved on database, so can live there for longer time, and can be huge.

这篇关于Asp.net缓存或手动缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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