private static void OnRemovalCallBack(object key, object value, EvictionReason reason, object state)
        {
            Console.WriteLine($"CIevents count {((List<string>)value).Count }");
            Console.WriteLine($"Cache key :{(string)key} {reason.ToString()}");
            Console.WriteLine($"DB input:  [{string.Join(',', ((List<string>)value))}]");

            // Code to publish data to db and EH
            // Batch insert db and batch publish messages.
        }
Esempio n. 2
0
        /// <summary>
        /// 缓存失效回调
        /// </summary>
        /// <param name="cacheKey">缓存key值</param>
        /// <param name="cacheValue">缓存的对象</param>
        /// <param name="reason">缓存移出原因</param>
        /// <param name="state"></param>
        private static void MyCallback(object cacheKey, object cacheValue, EvictionReason reason, object state)
        {
            var sb = Pool.StringBuilder.Get();

            sb.Append(
                string.Format("Cache Key: {0} invalid at {1} with reason {2}",
                              new object[]
            {
                cacheKey, DateTime.Now.ToString(BaseSystemInfo.DateTimeLongFormat), reason.ToString()
            }));
            LogUtil.WriteLog(sb.Put(), "Cache", null, "Cache");
        }
Esempio n. 3
0
 private void FillCacheAgain(object key, object value, EvictionReason reason, object state)
 {
     _logger.LogInformation(LogEventIds.LoadHomepage, "Cache was cleared: reason " + reason.ToString());
 }