BuildCache() public méthode

Configure the cache
public BuildCache ( string regionName, string>.IDictionary properties ) : ICache
regionName string the name of the cache region
properties string>.IDictionary configuration settings
Résultat ICache
Exemple #1
0
        public void Build_Cache_From_AppConfig()
        {
            const string Region = @"NSoft.NFramework.Membase";

            ICache cache = _provider.BuildCache(Region, null);

            Assert.IsNotNull(cache);
            Assert.AreEqual(Region, cache.RegionName);
        }
Exemple #2
0
        public void Clear_Cache_Value()
        {
            const string key   = "key1";
            const string value = "value";

            ICache cache = _provider.BuildCache("mbunit", _props);

            Assert.IsNotNull(cache, "no cache returned");

            lock (_syncLock) {
                // 캐시에 저장
                cache.Put(key, value);
                Thread.Sleep(100);

                // 캐시에 저장되었는지 확인
                var item = cache.Get(key);
                Assert.IsNotNull(item, "캐시에서 정보를 찾을 수 없습니다. key=" + key);

                // 캐시 정보 모두 삭제
                // cache.Clear();
                cache.Remove(key);

                item = cache.Get(key);
                Assert.IsNull(item, "캐시에서 정보를 아직 있습니다. key=" + key);
            }
        }