/// <summary>
        /// Test CacheData.
        /// Put and get a set of data from cache.
        /// </summary>
        public void TestCacheData()
        {
            var map  = new Hashtable();
            var keys = new ArrayList();

            for (int i = 0; i < 100; i++)
            {
                string key = "key" + i;
                keys.Add(key);
                map.Add(key, i);
            }

            namedCache.Clear();
            namedCache.InsertAll(map);
            ICollection entrySet = namedCache.GetAll(keys);

            Assert.AreEqual(100, entrySet.Count);
            namedCache.Release();
        }
Пример #2
0
 /// <summary>
 /// Release this cache, optionally destroying it.
 /// </summary>
 /// <param name="fDestroy">
 /// If true, destroy the cache as well.
 /// </param>
 protected virtual void Release(Boolean fDestroy)
 {
     try
     {
         INamedCache cache = BackCache;
         UnregisterBackServiceMemberEventHandler();
         base.Release();
         if (fDestroy)
         {
             cache.Destroy();
         }
         else
         {
             cache.Release();
         }
     }
     catch (Exception)
     {
         // one of the following should be ignored:
         // IllegalOperationException("Cache is not active");
         // Exception("Storage is not configured");
         // Exception("Service has been terminated");
     }
 }