예제 #1
0
 private void OnBeforeSetWrapper(string key, InMemoryCacheItem item)
 {
     ThreadHelper.RunOnDifferentThread(() => { if (OnBeforeSet != null)
                                               {
                                                   OnBeforeSet(key, item);
                                               }
                                       }, true);
 }
예제 #2
0
 void OnBeforeSetWrapper(string key, InMemoryCacheItem item, bool isManagerCall)
 {
     if (isManagerCall)
     {
         return;
     }
     //ThreadHelper.RunOnDifferentThread(() => { if (OnBeforeSet != null) OnBeforeSet(key, item); }, true);
     OnBeforeSet?.Invoke(key, item);
 }
예제 #3
0
        public override void Set(string key, object data, TimeSpan expiresIn, bool isManagerCall = false)
        {
            _logger.Log(LogLevel.Debug, "LittleThunder Set");
            var item = new InMemoryCacheItem(data, expiresIn);

            OnBeforeSetWrapper(key, item, isManagerCall);
            var func = new Func <string, InMemoryCacheItem, InMemoryCacheItem>((s, cacheItem) => item);

            _concurrentStore.AddOrUpdate(key, item, func);
            OnAfterSetWrapper(key, isManagerCall);
        }
예제 #4
0
        public override void Set(string key, object value, TimeSpan expiresIn)
        {
            _options.Logger.Log(LogLevel.Debug, "LittleThunder Set");
            var item = new InMemoryCacheItem(value, expiresIn);

            OnBeforeSetWrapper(key, item);
            var func = new Func <string, InMemoryCacheItem, InMemoryCacheItem>((s, cacheItem) => item);

            _concurrentStore.AddOrUpdate(key, item, func);
            OnAfterSetWrapper(key);
        }
예제 #5
0
 private void _localCacheProvider_OnBeforeSet(string key, InMemoryCacheItem item)
 {
     OnBeforeSet(key, item);
 }
예제 #6
0
 // TODO: This method or some method should be triggered by developer(user) indirectly...
 public void OnBeforeSet(string key, InMemoryCacheItem item)
 {
     _logger.Log(LogLevel.Trace, string.Format("GreatEagle OnBeforeSet {0}", key));
     _remoteCacheProvider.Set(key, item, item.GetExpireTimeSpan());
     //TODO: Create temp remote cache item to make wait tribe for current member
 }