【发布时间】:2011-12-24 08:53:02
【问题描述】:
在 MSDN 论坛上也有这个问题 (http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/0a666d5e-9bda-47bd-8dd3-98d32eb5fe60/?prof=required),我想我会在这里得到人们的意见:
这是我的即时窗口的输出:
(EmployeeCache as MemoryCache).Add("test", new Object(),DateTimeOffset.Now.AddMinutes(10));
true
(EmployeeCache as MemoryCache).GetCount()
0
(EmployeeCache as MemoryCache)
{<namespace>.CustomCache}
[<namespace>.CustomCache]: {[<namespace>.CustomCache}
base {System.Runtime.Caching.ObjectCache}: {<namespace>.CustomCache}
CacheMemoryLimit: 1887436800
DefaultCacheCapabilities: InMemoryProvider | CacheEntryChangeMonitors | AbsoluteExpirations | SlidingExpirations | CacheEntryUpdateCallback | CacheEntryRemovedCallback
Name: "keyname"
PhysicalMemoryLimit: 99
PollingInterval: {00:02:00}
在什么情况下添加到 MemoryCache 会返回 true,但对象不会被缓存? (对 GetCount 的调用及其后的调用是在添加到缓存后立即进行的)
【问题讨论】: