缓存在C#/。NET缓存、NET

由网友(哼著情歌享受寂寞)分享简介:我想问问你什么是C#实现高速缓存的最佳方法?有没有可能通过使用特定的.Net类或类似的东西?也许像一本字典,将删除某些项,如果它变得太大,但其参赛作品将不会被垃圾收集器删除?I wanted to ask you what is the best approach to implement a cache in C#...

我想问问你什么是C#实现高速缓存的最佳方法?有没有可能通过使用特定的.Net类或类似的东西?也许像一本字典,将删除某些项,如果它变得太大,但其参赛作品将不会被垃圾收集器删除?

I wanted to ask you what is the best approach to implement a cache in C#? Is there a possibility by using given .Net-classes or something like that? Perhaps something like a dictionary that will remove some entries if it gets too large but whose entries won't be removed by the garbage collector?

在此先感谢

塞巴斯蒂安

推荐答案

如果你使用asp.net,你可以使用缓存类(System.Web.Caching)。

If you're using asp.net you could use the Cache class (System.Web.Caching).

下面是一个很好的辅助类:链接文字

Here is a good helper class: link text

如果你的意思是缓存在Windows窗体应用程序,这取决于你正在努力做什么,并在那里你想缓存数据。

If you mean caching in a windows form app, it depends on what you're trying to do, and where you're trying to cache the data.

我们已经实现了后面的web服务的某些方法一个缓存 (使用System.Web.Caching对象。)。

We've implemented a Cache behind a webservice for certain methods (Using the System.Web.Caching object.).

然而,你可能也想看看缓存应用程序块。 (见这里) 这是企业库的.NET Framework 2.0

However you might also want to look at the Caching Application Block. (See here) Which is part of the Enterprise Library for .NET Framework 2.0

阅读全文

相关推荐

最新文章