Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var applicationContainer = new BlockContainer();
            BlockRegister.Initialize(applicationContainer);
            var cachingBlock = new CachingBlock();

            BlockRegister.RegisterInstance<CachingBlock>(cachingBlock);

            var mBackingStore = new NullBackingStore();
            var mInstrumentationProvider = new NullCachingInstrumentationProvider();
            var dataCache = new Cache(mBackingStore, mInstrumentationProvider);
            var mExpirationTask = new ExpirationTask(dataCache, mInstrumentationProvider);
            var mScavengerTask = new ScavengerTask(1, 5, dataCache, mInstrumentationProvider);
            var mBackgroundScheduler = new BackgroundScheduler(mExpirationTask, mScavengerTask, mInstrumentationProvider);
            var mExpirationPollTimer = new ExpirationPollTimer(1000);
            var dataCacheManager = new CacheManager(dataCache, mBackgroundScheduler, mExpirationPollTimer);

            var mCachingBlock = BlockRegister.GetInstance<CachingBlock>();
            mCachingBlock.RegisterInstance("MyApplicationCache", dataCacheManager);
        }
Exemple #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            var applicationContainer = new BlockContainer();
            BlockRegister.Initialize(applicationContainer);
            var cachingBlock = new CachingBlock();

            var dataCacheManager = new CacheManager();

            BlockRegister.RegisterInstance<CachingBlock>(cachingBlock);
            cachingBlock.RegisterInstance("MyApplicationCache", dataCacheManager);
        }