/// <summary>
 /// Adiciona um novo item.
 /// </summary>
 /// <param name="key">Chave da entrada que será adicionada..</param>
 /// <param name="value">Valor do item.</param>
 internal void Add(long key, object value)
 {
     if (_index.Count == 0)
     {
         _head = key;
     }
     if (_index.ContainsKey(key))
     {
         var entry = (EvictionIndexEntry)_index[key];
         if (entry != null)
         {
             entry.Insert(value);
         }
     }
     else
     {
         var entry2 = new EvictionIndexEntry();
         entry2.Insert(value);
         _index[key] = entry2;
         var entry3 = _index[_tail] as EvictionIndexEntry;
         if (entry3 != null)
         {
             entry3.Next = key;
         }
         entry2.Previous = _tail;
     }
     if (key > _tail)
     {
         _tail = key;
     }
 }
        /// <summary>
        /// Insere um nova entrada para o indice.
        /// </summary>
        /// <param name="key">Chave que identifica a entrada.</param>
        /// <param name="value">Valor da entrada.</param>
        /// <param name="previous">Identificador da entrada anterior.</param>
        /// <param name="next">Identificador da próxima entrada.</param>
        internal void Insert(long key, object value, long previous, long next)
        {
            EvictionIndexEntry entry  = _index[next] as EvictionIndexEntry;
            EvictionIndexEntry entry2 = _index[previous] as EvictionIndexEntry;

            if ((_index.Count == 0) || (key < _head))
            {
                _head = key;
            }
            if (_index.ContainsKey(key))
            {
                EvictionIndexEntry entry3 = (EvictionIndexEntry)_index[key];
                if (entry3 != null)
                {
                    entry3.Insert(value);
                }
            }
            else
            {
                EvictionIndexEntry entry4 = new EvictionIndexEntry();
                entry4.Insert(value);
                _index[key] = entry4;
                if ((entry2 == null) && (entry == null))
                {
                    entry4.Next     = -1;
                    entry4.Previous = -1;
                }
                else if ((entry2 == null) && (entry != null))
                {
                    entry4.Next     = next;
                    entry4.Previous = -1;
                    entry.Previous  = key;
                }
                else if ((entry2 != null) && (entry == null))
                {
                    entry4.Previous = previous;
                    entry4.Next     = -1;
                    entry2.Next     = key;
                }
                else
                {
                    entry4.Previous = previous;
                    entry4.Next     = next;
                    entry2.Next     = key;
                    entry.Previous  = key;
                }
            }
            if (key > _tail)
            {
                _tail = key;
            }
        }