private void Start() { if (graph != null) { processor = new ConditionalProcessor(graph); } processor.Run(); }
public void TestConditional() { IConfigurableCacheFactory ccf = CacheFactory.ConfigurableCacheFactory; IXmlDocument config = XmlHelper.LoadXml("assembly://Coherence.Tests/Tangosol.Resources/s4hc-local-cache-config.xml"); ccf.Config = config; INamedCache cache = CacheFactory.GetCache("local-default"); cache.Clear(); Hashtable ht = new Hashtable(); ht.Add("conditionalKey1", 200); ht.Add("conditionalKey2", 250); ht.Add("conditionalKey3", 300); ht.Add("conditionalKey4", 400); cache.InsertAll(ht); IFilter lessThen300 = new LessFilter(IdentityExtractor.Instance, 300); ConditionalProcessor processor = new ConditionalProcessor( new GreaterFilter(IdentityExtractor.Instance, 200), new ConditionalRemove(lessThen300, false)); Assert.IsTrue(cache.Count == 4); cache.Invoke("conditionalKey4", processor); Assert.IsTrue(cache.Count == 4); cache.Invoke("conditionalKey3", processor); Assert.IsTrue(cache.Count == 4); cache.Invoke("conditionalKey2", processor); Assert.IsTrue(cache.Count == 3); CacheFactory.Shutdown(); }