Prerequisites:
Namespaces: InRule.Runtime
Classes: RuleApplicationReference
See Also: Creating a RuleSession with Cache Retention, Controlling Compilation and Cache Retention, Adding Items into the Cache, Working with the Rule Application Cache
References: InRule.Runtime.dll, InRule.Common.dll
You can iterate through all the cache entries to get information:
public string GetCacheEntriesInfo()
{
var sb = new StringBuilder();
// Get the existing cache entries from the RuleSession - this returns
// a set of RuleApplicationReferences
IEnumerable<RuleApplicationReference> cacheEntries;
cacheEntries = RuleSession.RuleApplicationCache.Items;
foreach (RuleApplicationReference cacheEntry in cacheEntries)
{
// Extract information from the rule application
sb.AppendLine("Rule App Name:" + cacheEntry.GetRuleApplicationDef().Name);
sb.AppendLine("Unique Name:" + cacheEntry.Name);
// if it has been compiled, you can get properties such as time
if (cacheEntry.LastMetadataCompile != null)
{
DateTime lastMetaCompileTime = cacheEntry.LastMetadataCompile.Value.UtcDateTime;
sb.AppendLine("Last metadata compile:" + lastMetaCompileTime.ToString());
}
// get information about its rank in the cache
sb.AppendLine("Cache retention rank:" + cacheEntry.CacheRetention.Weight.ToString());
sb.AppendLine();
}
return sb.ToString();
}
Comments
0 comments
Please sign in to leave a comment.