缓存在C#/。NET [英] Caching in C#/.Net

查看:148
本文介绍了缓存在C#/。NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问问你什么是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

这篇关于缓存在C#/。NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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