【发布时间】:2014-08-25 19:18:39
【问题描述】:
我正在使用 system.Runtime.Caching.dll 来缓存一些值。但是当我实施区域时,我得到了错误。例外是:“参数 regionName 必须为空。”你对这个问题有什么想法吗?为什么我得到这个。或者我如何在 .net 缓存方法中添加区域...
我的示例源代码是:
ObjectCache cache = MemoryCache.Default;
policy.AbsoluteExpiration = DateTimeOffset.Now.AddSeconds(100000.0);
cache.Add("xxtr", "turkish", policy, "EN");
cache.Add("xxtr", "türkçe", policy, "TR");
cache.Add("xxtr", "ru_turki", policy, "RU");
cache.Add("xxru", "russia", policy, "EN");
cache.Add("xxru", "rusça", policy, "TR");
cache.Add("xxru", "ru_russi", policy, "RU");
string df = cache.GetValues("TR", "xxtr").ToString();
【问题讨论】:
-
regionName 在哪里?
-
基本上MemoryCache不支持regions,见stackoverflow.com/questions/9003656/…