Example #1
0
        public HappyPather(DependencyContainer dependencyContainer)
        {
            var container = dependencyContainer;

            _demoHelper  = container.Resolve <IDemoHelper>();
            _localCache  = container.Resolve <ILocalCacheProvider>();
            _remoteCache = container.Resolve <IRemoteCacheProvider>(DependencyContainer.RemoteCacheProviderName);
        }
Example #2
0
        public HappyPather(IDependencyContainer <IContainer> demoDependencyContainer, string key)
        {
            var container = demoDependencyContainer;

            _demoHelper  = container.Resolve <IDemoHelper>();
            _localCache  = container.Resolve <ILocalCacheProvider>();
            _remoteCache = container.Resolve <IRemoteCacheProvider>();
            _localCache.Delete(key, false);
            _remoteCache.Delete(key, false);
        }
Example #3
0
 public GreatEagle(string memberName, IMessagePublisher messagePublisher, IMessageSubscriber messageSubscriber, ISerializer serializer, ILocalCacheProvider localCacheProvider, IRemoteCacheProvider remoteCacheProvider, ILogger logger)
 {
     _memberName         = memberName;
     _logger             = logger;
     _messagePublisher   = messagePublisher;
     _messageSubscriber  = messageSubscriber;
     _serializer         = serializer;
     _localCacheProvider = localCacheProvider;
     StartObserving();
     _remoteCacheProvider = remoteCacheProvider;
     _messageSubscriber.OnMessageReceived += MessageSubscriberMessageReceived;
     _messageSubscriber.StartSubscription();
 }
Example #4
0
 /// <summary>
 ///     Default constructor for GreatEagle
 /// </summary>
 /// <param name="memberName">Observing tribe member name </param>
 /// <param name="subscriptionManager"></param>
 /// <param name="serializer"></param>
 /// <param name="localCacheProvider"></param>
 /// <param name="remoteCacheProvider"></param>
 /// <param name="logger"></param>
 public GreatEagle(string memberName, ISubscriptionManager subscriptionManager, ISerializer serializer,
                   ILocalCacheProvider localCacheProvider, IRemoteCacheProvider remoteCacheProvider, ILogger logger)
 {
     _memberName          = memberName;
     _subscriptionManager = subscriptionManager;
     _logger              = logger;
     _serializer          = serializer;
     _localCacheProvider  = localCacheProvider;
     _remoteCacheProvider = remoteCacheProvider;
     _subscriptionManager.OnMessageReceived += MessageSubscriberMessageReceived;
     StartObserving();
     LoadFromRemote();
 }
Example #5
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
 }
 public void FixtureSetup()
 {
     _container = new ServiceContainer();
     _container.SetDefaultLifetime <PerContainerLifetime>();
     //_container.Register<ILogger>(factory => new ConsoleLogger(LogLevel.Trace));
     _container.Register <ILogger, NullLogger>();
     _logger = _container.GetInstance <ILogger>();
     _container.Register <IDemoHelper, DemoHelper>();
     _container.Register <ILocalCacheProviderOptions>(factory => new LocalCacheProviderOptions(factory.GetInstance <ILogger>()));
     _container.Register <ILocalCacheProvider, LittleThunder>();
     _demoHelper            = _container.GetInstance <IDemoHelper>();
     _cache                 = _container.GetInstance <ILocalCacheProvider>();
     _cache.OnBeforeGet    += _cache_OnBeforeGet;
     _cache.OnAfterGet     += _cache_OnAfterGet;
     _cache.OnBeforeSet    += _cache_OnBeforeSet;
     _cache.OnAfterSet     += _cache_OnAfterSet;
     _cache.OnBeforeDelete += _cache_OnBeforeDelete;
     _cache.OnAfterDelete  += _cache_OnAfterDelete;
 }
Example #7
0
        public void FixtureSetup()
        {
            var builder = new ContainerBuilder();

            _logger = new NullLogger();
            builder.RegisterInstance(_logger).As <ILogger>().SingleInstance();
            builder.RegisterType <DemoHelper>().As <IDemoHelper>().SingleInstance();
            builder.RegisterType <LocalCacheProviderOptions>().As <ILocalCacheProviderOptions>().SingleInstance();
            builder.Register <LittleThunder>(c => new LittleThunder(c.Resolve <ILocalCacheProviderOptions>(), c.Resolve <ILogger>())).As <ILocalCacheProvider>().SingleInstance();
            _container = builder.Build();

            _demoHelper            = _container.Resolve <IDemoHelper>();
            _cache                 = _container.Resolve <ILocalCacheProvider>();
            _cache.OnBeforeGet    += _cache_OnBeforeGet;
            _cache.OnAfterGet     += _cache_OnAfterGet;
            _cache.OnBeforeSet    += _cache_OnBeforeSet;
            _cache.OnAfterSet     += _cache_OnAfterSet;
            _cache.OnBeforeDelete += _cache_OnBeforeDelete;
            _cache.OnAfterDelete  += _cache_OnAfterDelete;
        }
 public HomeController(ILocalCacheProvider localCache, IRemoteCacheProvider remoteCache, IDemoService service)
 {
     this._localCache  = localCache;
     this._remoteCache = remoteCache;
     this._service     = service;
 }
Example #9
0
 public RedisCacheSubscriber(ILocalCacheProvider localCache, ISerializer serialize)
 {
     this._localCache = localCache;
     this._serialize  = serialize;
 }
Example #10
0
 public CacheController(ILocalCacheProvider littleThunder, IDemoHelper demoHelper)
 {
     _littleThunder = littleThunder;
     _demoHelper    = demoHelper;
 }