/// <summary>
 ///     Reset (Reset whole provider) provider with Concurrency Level and Initial Capacity parameters.
 /// </summary>
 public void Reset(ILocalCacheProviderOptions options)
 {
     // Set options
     _options = options;
     _options.Logger.Log(LogLevel.Trace, "LittleThunder Reset Begin");
     _timer.Stop();
     _concurrentStore = new ConcurrentDictionary <string, InMemoryCacheItem>(_options.ConcurrencyLevel, _options.InitialCapacity);
     _timer.Start();
     _options.Logger.Log(LogLevel.Trace, "LittleThunder Reset End");
 }
Exemple #2
0
 /// <summary>
 ///     Constructor with options as <see cref="ILocalCacheProviderOptions">ICacheProviderOptions</see>
 /// </summary>
 /// <param name="options"></param>
 /// <param name="logger"></param>
 public LittleThunder(ILocalCacheProviderOptions options, ILogger logger)
 {
     _logger  = logger;
     _options = options;
     _logger.Log(LogLevel.Trace, "LittleThunder Constructor Begin");
     //_options.Observer.SetupMember(this);
     _concurrentStore = new ConcurrentDictionary <string, InMemoryCacheItem>(_options.ConcurrencyLevel, _options.InitialCapacity);
     _timer           = new Timer(timer_Elapsed, null, Thousand, Thousand);
     _logger.Log(LogLevel.Trace, "LittleThunder Constructor End");
 }
 /// <summary>
 ///     Constructor with options as <see cref="ILocalCacheProviderOptions">ICacheProviderOptions</see>
 /// </summary>
 /// <param name="options"></param>
 public LittleThunder(ILocalCacheProviderOptions options)
 {
     _options = options;
     _options.Logger.Log(LogLevel.Trace, "LittleThunder Constructor Begin");
     //_options.Observer.SetupMember(this);
     _concurrentStore = new ConcurrentDictionary <string, InMemoryCacheItem>(_options.ConcurrencyLevel, _options.InitialCapacity);
     _timer.Elapsed  += timer_Elapsed;
     _timer.Start();
     _options.Logger.Log(LogLevel.Trace, "LittleThunder Constructor End");
 }
Exemple #4
0
 public YakariPack(ILocalCacheProviderOptions localCacheProviderOptions, string tribeName, string memberName, string redisConnectionString, LogLevel loglevel)
 {
     _logger = new ConsoleLogger(loglevel);
     // Default Serializer
     _serializer = new JsonNetSerializer();
     //Redis Remote Cache Provider for Yakari
     _remoteCacheProvider = new RedisCacheProvider(redisConnectionString, _serializer, _logger);
     //Redis Subscription Manager for tribe communication.
     _subscriptionManager = new RedisSubscriptionManager(redisConnectionString, tribeName, _logger);
     // Little Thunder the Local Cache Provider
     _localCacheProvider = new LittleThunder(localCacheProviderOptions, _logger);
     // The Great Eagle
     _observer = new GreatEagle(memberName, _subscriptionManager, _serializer, _localCacheProvider, _remoteCacheProvider, _logger);
     // Great eagle start observing and loads every previous remote cache items in seperate thread
 }