简体   繁体   English

缓存到ASP.NET中的文件(不是内存)

[英]Caching to files (not memory) in ASP.NET

Is there any simle way how to save objects to files in selected directory? 有什么简单的方法可以将对象保存到选定目录中的文件吗?

I have: 我有:

  • Object (webservice response) 对象 (Web服务响应)
  • Id (md5 hash) ID (MD5哈希)
  • Cache life time (6 days) 缓存寿命 (6天)
  • Folder (where to save files) 文件夹 (保存文件的位置)

I need: some solution, where I can 我需要:可以解决的办法

  • set cache directory 设置缓存目录
  • set hierarchical directory level (all files cannot be in one directory, there can be thousands of files) 设置分层目录级别 (所有文件不能在一个目录中,可以有数千个文件)
  • add (rewrite expired file) / get object to / from cache 添加 (重写过期文件)/从缓存中获取对象
  • thread safety 线程安全

.Net has the ability to create custom cache providers. .Net可以创建自定义缓存提供程序。

I have seen articles on how to create a disk based one. 我看过有关如何创建基于磁盘的文章。

here is a link on creating a mongodb based one. 这是创建基于mongodb的链接。 Dependent on your experience level that may be enough to see you through. 取决于您的经验水平,足以让您了解。 http://msdn.microsoft.com/en-us/magazine/gg650661.aspx http://msdn.microsoft.com/zh-CN/magazine/gg650661.aspx

I'll see if I can find the article about the disk based one. 我将看看是否能找到有关基于磁盘的文章。

found it http://www.4guysfromrolla.com/articles/061610-1.aspx 找到了它http://www.4guysfromrolla.com/articles/061610-1.aspx

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM