/// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or
 /// resetting unmanaged resources.
 /// </summary>
 public override void Dispose()
 {
     base.Dispose();
     if (_queryIndexManager != null)
     {
         _queryIndexManager.Dispose();
         _queryIndexManager = null;
     }
     if (_grpIndexManager != null)
     {
         _grpIndexManager.Dispose();
         _grpIndexManager = null;
     }
 }
Beispiel #2
0
        /// <summary>
        /// Construtor padrão.
        /// </summary>
        /// <param name="cacheClasses"></param>
        /// <param name="parentCache">Cache pai.</param>
        /// <param name="properties">Propriedades de configuração da instancia.</param>
        /// <param name="listener"></param>
        /// <param name="context"></param>
        /// <param name="activeQueryAnalyzer"></param>
        public IndexedLocalCache(IDictionary cacheClasses, CacheBase parentCache, IDictionary properties, ICacheEventsListener listener, CacheRuntimeContext context, ActiveQueryAnalyzer activeQueryAnalyzer) : base(cacheClasses, parentCache, properties, listener, context, activeQueryAnalyzer)
        {
            _grpIndexManager = new GroupIndexManager();
            IDictionary props = null;

            if (properties.Contains("indexes"))
            {
                props = properties["indexes"] as IDictionary;
            }
            _queryIndexManager = new NamedTagIndexManager(props, this, base._context.CacheRoot.Name);
            if (!_queryIndexManager.Initialize())
            {
                _queryIndexManager = null;
            }
        }
        /// <summary>
        /// Overloaded constructor. Takes the properties as a map.
        /// </summary>
        /// <param name="cacheSchemes">collection of cache schemes (config properties).</param>
        /// <param name="properties">properties collection for this cache.</param>
        /// <param name="listener">cache events listener</param>
        /// <param name="timeSched">scheduler to use for periodic tasks</param>
        public IndexedLocalCache(IDictionary cacheClasses, CacheBase parentCache, IDictionary properties, ICacheEventsListener listener, CacheRuntimeContext context

                                 , ActiveQueryAnalyzer activeQueryAnalyzer

                                 )
            : base(cacheClasses, parentCache, properties, listener, context

                   , activeQueryAnalyzer

                   )
        {
            _grpIndexManager = new GroupIndexManager();


            IDictionary props = null;

            if (properties.Contains("indexes"))
            {
                props = properties["indexes"] as IDictionary;
            }

            _queryIndexManager = new NamedTagIndexManager(props, this, _context.CacheRoot.Name);

            if (!_queryIndexManager.Initialize(null))
            {
                _queryIndexManager = null;
            }

            _cacheStore.ISizableQueryIndexManager      = _queryIndexManager;
            _cacheStore.ISizableGroupIndexManager      = _grpIndexManager;
            _cacheStore.ISizableEvictionIndexManager   = _evictionPolicy;
            _cacheStore.ISizableExpirationIndexManager = _context.ExpiryMgr;

            _stats.MaxCount = _cacheStore.MaxCount;
            _stats.MaxSize  = _cacheStore.MaxSize;

            if (_context.PerfStatsColl != null)
            {
                if (_queryIndexManager != null)
                {
                    _context.PerfStatsColl.SetQueryIndexSize(_queryIndexManager.IndexInMemorySize);
                }

                _context.PerfStatsColl.SetGroupIndexSize(_grpIndexManager.IndexInMemorySize);
            }
        }