internal virtual ArrayList ReEvaluate(AttributeIndex index, LocalCacheBase cache, IDictionary attributeValues, string cacheContext) { QueryContext context = new QueryContext(cache); context.AttributeValues = attributeValues; context.Index = index; context.CacheContext = cacheContext; Execute(context, null); context.Tree.Reduce(); return context.Tree.LeftList; }
/// <summary> /// Method that allows the object to initialize itself. Passes the property map down /// the object hierarchy so that other objects may configure themselves as well.. /// </summary> /// <param name="cacheSchemes">collection of cache schemes (config properties).</param> /// <param name="properties">properties collection for this cache.</param> protected override void Initialize(IDictionary cacheClasses, IDictionary properties) { if(properties == null) throw new ArgumentNullException("properties"); try { base.Initialize(cacheClasses, properties); { IDictionary schemeProps = ConfigHelper.GetCacheScheme(cacheClasses, properties, "primary-cache"); string cacheType = Convert.ToString(schemeProps[ "type" ]).ToLower(); if(cacheType.CompareTo("local-cache") == 0) { // very important to note that the perf collector is not passed further down. _primary = CreateLocalCache(this,cacheClasses, schemeProps); _primary._allowAsyncEviction = false; //do not evict item asynchronously. } else if(cacheType.CompareTo("overflow-cache") == 0) { _primary = CreateOverflowCache(cacheClasses, schemeProps); } else { throw new ConfigurationException("invalid or non-local cache class specified in composite cache"); } } { IDictionary schemeProps = ConfigHelper.GetCacheScheme(cacheClasses, properties, "secondary-cache"); string cacheType = Convert.ToString(schemeProps[ "type" ]).ToLower(); if(cacheType.CompareTo("local-cache") == 0) { _secondary = CreateLocalCache(_parentCache, cacheClasses, schemeProps); _secondary._allowAsyncEviction = true; } else if(cacheType.CompareTo("overflow-cache") == 0) { _secondary = CreateOverflowCache(cacheClasses, schemeProps); } else { throw new ConfigurationException("invalid or non-local cache class specified in composite cache"); } } _primary.Listener = new PrimaryCacheListener(this); _secondary.Listener = new SecondaryCacheListener(this); } catch(ConfigurationException e) { if (_context != null) { _context.NCacheLog.Error("OverflowCache.Initialize()", e.Message); } Dispose(); throw; } catch(Exception e) { if (_context != null) { _context.NCacheLog.Error("OverflowCache.Initialize()", e.Message); } Dispose(); throw new ConfigurationException("Configuration Error: " + e.ToString(), e); } }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or /// resetting unmanaged resources. /// </summary> public override void Dispose() { if(_primary != null) { _primary.Dispose(); _primary = null; } if(_secondary != null) { _secondary.Dispose(); _secondary = null; } base.Dispose(); }