/// <summary>
 /// Libera a instancia.
 /// </summary>
 public void Dispose()
 {
     if (_readerProivder != null)
     {
         IEnumerator enumerator = _readerProivder.Values.GetEnumerator();
         while (enumerator.MoveNext())
         {
             if (enumerator.Current != null)
             {
                 ((IDisposable)enumerator.Current).Dispose();
             }
         }
         _readerProivder = null;
     }
     if (_writeBehindAsyncProcess != null)
     {
         _writeBehindAsyncProcess.Stop();
         _writeBehindAsyncProcess = null;
     }
     if (_writerProivder != null)
     {
         IEnumerator enumerator2 = _writerProivder.Values.GetEnumerator();
         while (enumerator2.MoveNext())
         {
             if (enumerator2.Current != null)
             {
                 ((IDisposable)enumerator2.Current).Dispose();
             }
         }
         _writerProivder = null;
     }
     if (_asyncProc != null)
     {
         _asyncProc.Stop();
         _asyncProc = null;
     }
 }
 /// <summary>
 /// Inicializa a instancia.
 /// </summary>
 /// <param name="properties">Propriedades de configuração.</param>
 /// <param name="timeout"></param>
 private void Initialize(IDictionary properties, long timeout)
 {
     properties.Require("properties").NotNull();
     try
     {
         if (properties.Contains("read-thru"))
         {
             IDictionary dictionary = (IDictionary)properties["read-thru"];
             string      str        = (string)dictionary["enabled"];
             if (str.ToLower() == "true")
             {
                 IDictionary dictionary2 = (IDictionary)dictionary["read-thru-providers"];
                 if (dictionary2 != null)
                 {
                     IDictionaryEnumerator enumerator = dictionary2.GetEnumerator();
                     while (enumerator.MoveNext())
                     {
                         if (!_readerProivder.ContainsKey(enumerator.Key.ToString().ToLower()))
                         {
                             _readerProivder.Add(enumerator.Key.ToString().ToLower(), new ReadThruProviderManager(_cacheName, dictionary2[enumerator.Key] as Hashtable, _context));
                         }
                     }
                 }
             }
         }
         if (properties.Contains("write-thru"))
         {
             IDictionary dictionary3 = (IDictionary)properties["write-thru"];
             string      str2        = (string)dictionary3["enabled"];
             if (str2.ToLower() == "true")
             {
                 IDictionary dictionary4 = (IDictionary)dictionary3["write-thru-providers"];
                 if (dictionary4 != null)
                 {
                     IDictionaryEnumerator enumerator2 = dictionary4.GetEnumerator();
                     while (enumerator2.MoveNext())
                     {
                         if (!_writerProivder.ContainsKey(enumerator2.Key.ToString().ToLower()))
                         {
                             _writerProivder.Add(enumerator2.Key.ToString().ToLower(), new WriteThruProviderManager(_cacheName, dictionary4[enumerator2.Key] as Hashtable, _context, (int)timeout, enumerator2.Key.ToString()));
                         }
                     }
                 }
             }
         }
         foreach (KeyValuePair <string, WriteThruProviderManager> pair in _writerProivder)
         {
             if (!pair.Value.AsyncWriteEnabled)
             {
                 this.anyWriteThruEnabled = true;
                 break;
             }
         }
         foreach (KeyValuePair <string, WriteThruProviderManager> pair2 in _writerProivder)
         {
             if (pair2.Value.AsyncWriteEnabled)
             {
                 this.anyWriteBehindEnabled = true;
                 break;
             }
         }
         if ((_writerProivder != null) && this.anyWriteBehindEnabled)
         {
             _writeBehindAsyncProcess = new WriteBehindAsyncProcessor(timeout, _context.Logger);
         }
         if (_readerProivder != null)
         {
             _asyncProc = new AsyncProcessor("Cache.DataSourceMgr", _context.Logger);
             _asyncProc.Start();
         }
     }
     catch (ConfigurationException)
     {
         throw;
     }
     catch (Exception exception)
     {
         throw new ConfigurationException("Configuration Error: " + exception.ToString(), exception);
     }
 }