private void OnBeforeSetWrapper(string key, InMemoryCacheItem item) { ThreadHelper.RunOnDifferentThread(() => { if (OnBeforeSet != null) { OnBeforeSet(key, item); } }, true); }
void OnBeforeSetWrapper(string key, InMemoryCacheItem item, bool isManagerCall) { if (isManagerCall) { return; } //ThreadHelper.RunOnDifferentThread(() => { if (OnBeforeSet != null) OnBeforeSet(key, item); }, true); OnBeforeSet?.Invoke(key, item); }
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); }
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); }
private void _localCacheProvider_OnBeforeSet(string key, InMemoryCacheItem item) { OnBeforeSet(key, item); }
// 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 }