示例#1
0
 private void CacheRemovedCallback(CacheEntryRemovedArguments args)
 {
     if (monitor != null)
     {
         monitor.Dispose();
     }
 }
示例#2
0
        /**
         * @ 清理本机资源
         * */
        private void Dispose(bool disposing)
        {
            if (!this.m_disposeing && disposing)
            {
                if (monitor != null)
                {
                    monitor.Dispose();
                }

                m_disposeing = true;
            }
        }
        /// <summary>
        /// Calls when data in the cache was updated.
        /// </summary>
        /// <param name="arguments">The entity that responsible for displaying updated cache entry.</param>
        private void UpdateCallback(CacheEntryUpdateArguments arguments)
        {
            if (_monitor != null)
            {
                _monitor.Dispose();
            }

            _dependency.OnChange -= DependencyOnOnChange;

            if (_hasDataChanged)
            {
                CacheItemPolicy policy;

                arguments.UpdatedCacheItem       = new CacheItem(arguments.Key, LoadEntities(out policy));
                arguments.UpdatedCacheItemPolicy = policy;
                _hasDataChanged = false;

                ApplicationLogger.LogMessage(LogMessageType.Info, $"Data related to the {arguments.Key} ithe cache was updated and reloaded.");
            }
        }