コード例 #1
0
        /// <summary>
        /// Recalcula o predicado.
        /// </summary>
        /// <param name="index"></param>
        /// <param name="cache"></param>
        /// <param name="attributeValues"></param>
        /// <param name="cacheContext"></param>
        /// <returns></returns>
        internal virtual ArrayList ReEvaluate(AttributeIndex index, LocalCacheBase cache, IDictionary attributeValues, string cacheContext)
        {
            QueryContext queryContext = new QueryContext(cache);

            queryContext.AttributeValues = attributeValues;
            queryContext.Index           = index;
            queryContext.CacheContext    = cacheContext;
            this.Execute(queryContext, null);
            queryContext.Tree.Reduce();
            return(queryContext.Tree.LeftList);
        }
コード例 #2
0
        internal virtual ClusteredArrayList 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);

            return(context.InternalQueryResult.GetArrayList());
        }
コード例 #3
0
 /// <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();
 }
コード例 #4
0
 /// <summary>
 /// Método acionado quando um item é atualizado.
 /// </summary>
 /// <param name="key">Chave do item.</param>
 /// <param name="cacheEntry">Instancia da entrada.</param>
 /// <param name="cache">Instancia do cache.</param>
 /// <param name="cacheContext">Nome do contexto.</param>
 /// <param name="notify">True para notificar</param>
 void IQueryOperationsObserver.OnItemUpdated(object key, CacheEntry cacheEntry, LocalCacheBase cache, string cacheContext, bool notify)
 {
 }
コード例 #5
0
        /// <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);
            }
        }
コード例 #6
0
ファイル: OverflowCache.cs プロジェクト: fabrimaciel/colosoft
 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      str         = Convert.ToString(schemeProps["type"]).ToLower();
         if (str.CompareTo("local-cache") == 0)
         {
             _primary = this.CreateLocalCache(this, cacheClasses, schemeProps);
             _primary._allowAsyncEviction = false;
         }
         else
         {
             if (str.CompareTo("overflow-cache") != 0)
             {
                 throw new Colosoft.Caching.Exceptions.ConfigurationException("invalid or non-local cache class specified in composite cache");
             }
             _primary = this.CreateOverflowCache(cacheClasses, schemeProps);
         }
         IDictionary dictionary2 = ConfigHelper.GetCacheScheme(cacheClasses, properties, "secondary-cache");
         string      str2        = Convert.ToString(dictionary2["type"]).ToLower();
         if (str2.CompareTo("local-cache") == 0)
         {
             _secondary = this.CreateLocalCache(base._parentCache, cacheClasses, dictionary2);
             _secondary._allowAsyncEviction = true;
         }
         else
         {
             if (str2.CompareTo("overflow-cache") != 0)
             {
                 throw new Colosoft.Caching.Exceptions.ConfigurationException("invalid or non-local cache class specified in composite cache");
             }
             _secondary = this.CreateOverflowCache(cacheClasses, dictionary2);
         }
         _primary.Listener   = new PrimaryCacheListener(this);
         _secondary.Listener = new SecondaryCacheListener(this);
     }
     catch (Colosoft.Caching.Exceptions.ConfigurationException exception)
     {
         if (base._context != null)
         {
             base._context.Logger.Error("OverflowCache.Initialize()".GetFormatter(), exception.GetFormatter());
         }
         this.Dispose();
         throw;
     }
     catch (Exception exception2)
     {
         if (base._context != null)
         {
             base._context.Logger.Error("OverflowCache.Initialize()".GetFormatter(), exception2.GetFormatter());
         }
         this.Dispose();
         throw new Colosoft.Caching.Exceptions.ConfigurationException("Configuration Error: " + exception2.ToString(), exception2);
     }
 }
コード例 #7
0
 /// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="cache">Instancia do cache que será utilizada pelo indice.</param>
 public VirtualQueryIndex(LocalCacheBase cache)
 {
     _cache = cache;
 }
コード例 #8
0
ファイル: QueryContext.cs プロジェクト: fabrimaciel/colosoft
 /// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="cache">Instancia do cache local associado com o contexto.</param>
 public QueryContext(LocalCacheBase cache)
 {
     _cache    = cache;
     this.Tree = new SRTree();
 }