Ejemplo n.º 1
0
        protected override void ConfigureApplicationContainer(TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);

            var loggingService = new StringBuilderLoggingService();

            container.Register <ILoggingService>((c, p) => loggingService);

            // Cache Level 1 - In Memory
            ICacheProvider l1Cache = new InMemoryCacheProvider(
                new MemoryCache("In-Memory Cache"),
                loggingService);

            // Cache Level 2 - Redis
            ICacheProvider l2Cache = new RedisCacheProvider(
                ConfigurationManager.AppSettings["RedisHost"],
                loggingService,
                new LoggingOptions
            {
                LogCacheMisses = true,
                LogCacheHits   = true
            });

            l2Cache.Delete("Test-Cache-Key");

            container.Register <IDataService>(new DataService(
                                                  loggingService,
                                                  new[] { l1Cache, l2Cache }));
        }
Ejemplo n.º 2
0
        public HomeModule(
            IDataService dataService,
            StringBuilderLoggingService loggingService)
        {
            _dataService    = dataService;
            _loggingService = loggingService;

            Get["/"] = _ => View["Index", DoALittleDance()];
        }