我正在使用v4.0。
更新
到目前为止,我已经将这个一起攻击了:
public class AllFilter : IFilter
{
#region IFilter Members
IndexCollection IFilter.GetIndexCollection()
{
return new IndexCollection();
}
MatchOptions IFilter.GetMatchOptions()
{
return MatchOptions.MatchAll;
}
#endregion
}
public class CacheMonitorController : Controller
{
public ActionResult Index()
{
var results =
from result in ApplicationNamespace.GlobalNamespace.Query(new AllFilter()).OfType<StateServerKey>()
group result by result.AppId;
var b = new StringBuilder();
foreach (var result in results)
{
var cache = CacheFactory.GetCache(result.Key);
b.AppendLine(cache.Name);
}
return this.Content(b.ToString(), "text/plain");
}
}
不幸的是,即使在创建缓存时肯定有名称,缓存的名称也会出现null
。该名称当然需要在UI中识别,因此我需要一种方法来获取它。
答案 0 :(得分:1)
显然,在v4.0中无法做到这一点 - 两个存储本身的键以及值的键都存储为哈希(以uint
s的形式),因此,除非使用实际名称检索NamedCache,否则无法知道名称。
唯一的选择是跟踪缓存中另一个商店中密钥的字符串值。
根据ScaleOut软件的Mark Waterman的说法,将在v5.0中提供检索名称的功能,该版本将于2009年春季发布。