cod*_*ter 4 c# asp.net httpruntime.cache
我正在尝试使用HttpRuntime.Cache.Remove(key)删除缓存但是仍然可以.我想知道使用HttpRuntime.Cache的最佳做法是什么.
问候
Dar*_*rov 13
该删除方法工作完全正常,并从给定的关键缓存中删除的项目.这是一个例子:
class Program
{
static void Main()
{
// add an item to the cache
HttpRuntime.Cache["foo"] = "bar";
Console.WriteLine(HttpRuntime.Cache["foo"]); // prints bar
// remove the item from the cache
HttpRuntime.Cache.Remove("foo");
Console.WriteLine(HttpRuntime.Cache["foo"]); // prints empty string
}
}
Run Code Online (Sandbox Code Playgroud)
这可能是你使用它的方式错了.不幸的是,这个问题没有在你的问题中指明,所以我们可以提供帮助.
| 归档时间: |
|
| 查看次数: |
8210 次 |
| 最近记录: |