我用的是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中被识别,所以我需要一个方法来获得它。
发布于 2009-02-02 18:32:52
显然,在v4.0中无法做到这一点--这两个商店本身的键以及值的键都以散列形式存储(以uints的形式),因此除非使用实际名称检索NamedCache,否则不能知道名称。
唯一的选择是跟踪缓存中另一个存储区中键的字符串值。
据ScaleOut软件的Mark说,检索这些名字的能力将在v5.0中提供,该版本将于2009年春季发布。
https://stackoverflow.com/questions/503580
复制相似问题