Beispiel #1
0
        /// <summary>
        /// Remove a chave e o valor do indice.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        public virtual void RemoveFromIndex(object key, object value)
        {
            IDictionaryEnumerator enumerator = (value as Hashtable).GetEnumerator();

            while (enumerator.MoveNext())
            {
                string str = (string)enumerator.Key;
                if (_indexTable.Contains(str) || _indexTable.Contains(str = ConvertToNamedTagKey(str)))
                {
                    IIndexStore store = _indexTable[str] as IIndexStore;
                    object      obj2  = enumerator.Value;
                    if (obj2 != null)
                    {
                        store.Remove(obj2, key);
                    }
                    else
                    {
                        store.Remove(CacheNull.Value, key);
                    }
                    if (store.Size == 0)
                    {
                        if ((str == "$Tag$") || IsNamedTagKey(str))
                        {
                            _indexTable.Remove(str);
                        }
                        else
                        {
                            _indexTable[str] = CreateIndexStore();
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public virtual void RemoveFromIndex(object key, object value)
        {
            Hashtable             attributeValues = value as Hashtable;
            IDictionaryEnumerator valuesDic       = attributeValues.GetEnumerator();

            while (valuesDic.MoveNext())
            {
                string indexKey = (string)valuesDic.Key;

                if (_indexTable.Contains(indexKey))
                {
                    IIndexStore store = _indexTable[indexKey] as IIndexStore;
                    object      val   = valuesDic.Value;

                    long prev = store.IndexInMemorySize;

                    if (val != null)
                    {
                        store.Remove(val, key);
                    }
                    else
                    {
                        store.Remove("null", key);
                    }

                    if (store.Count == 0)
                    {
                        String storeDataType = ((RBStore)store).StoreDataType;
                        _indexTable[indexKey] = new RBStore(_cacheName, storeDataType);
                    }
                    _attributeIndexSize += store.IndexInMemorySize - prev;
                }
            }
        }
Beispiel #3
0
        public virtual void RemoveFromIndex(object key, object value)
        {
            lock (_mutex)
            {
                IDictionaryEnumerator valuesDic = ((Hashtable)value).GetEnumerator();

                while (valuesDic.MoveNext())
                {
                    string indexKey = (string)valuesDic.Key;

                    if (_indexTable.Contains(indexKey))
                    {
                        IIndexStore store = _indexTable[indexKey] as IIndexStore;
                        object      val   = valuesDic.Value;

                        if (val != null)
                        {
                            store.Remove(val, key);
                        }
                        else
                        {
                            store.Remove("null", key);
                        }

                        if (store.Count == 0 && indexKey == TAG_INDEX_KEY)
                        {
                            _indexTable.Remove(indexKey);
                        }
                    }
                }
            }
        }
Beispiel #4
0
        public virtual void RemoveFromIndex(object key, object value)
        {
            lock (_mutex)
            {
                bool             isNodeRemoved = false;
                CacheEntry       entry         = (CacheEntry)value;
                IndexInformation indexInfo     = entry.IndexInfo;
                if (indexInfo != null)
                {
                    foreach (IndexStoreInformation indexStoreInfo in indexInfo.IndexStoreInformations)
                    {
                        isNodeRemoved = false;
                        IIndexStore store = indexStoreInfo.Store;
                        if (indexStoreInfo.IndexPosition != null)
                        {
                            long prevSize = store.IndexInMemorySize;
                            isNodeRemoved        = store.Remove(key, indexStoreInfo.IndexPosition);
                            _attributeIndexSize += store.IndexInMemorySize - prevSize;
                        }
                    }
                    _keyIndexInformationSize -= indexInfo.IndexInMemorySize;
                }

                entry.IndexInfo = null;
            }
        }
Beispiel #5
0
 public virtual void RemoveFromIndex(object key, object value)
 {
     lock (_mutex)
     {
         CacheEntry       entry     = (CacheEntry)value;
         IndexInformation indexInfo = entry.IndexInfo;
         if (indexInfo != null && indexInfo.IndexStoreInformations != null)
         {
             foreach (IndexStoreInformation indexStoreInfo in indexInfo.IndexStoreInformations)
             {
                 IIndexStore store = indexStoreInfo.Store;
                 if (indexStoreInfo.IndexPosition != null)
                 {
                     long prevSize = store.IndexInMemorySize;
                     store.Remove(key, indexStoreInfo.IndexPosition);
                     _attributeIndexSize += store.IndexInMemorySize - prevSize;
                     string possibleNamedTagKey = ConvertToNamedTagKey(store.Name);
                     if (store.Count == 0 && IndexTable.ContainsKey(possibleNamedTagKey))
                     {
                         IndexTable.Remove(possibleNamedTagKey);
                     }
                 }
             }
             _keyIndexInformationSize -= indexInfo.IndexInMemorySize;
         }
         entry.IndexInfo = null;
     }
 }
        public override void RemoveFromIndex(object key, object value)
        {
            lock (_mutex)
            {
                Hashtable             attributeValues = value as Hashtable;
                IDictionaryEnumerator valuesDic       = attributeValues.GetEnumerator();

                while (valuesDic.MoveNext())
                {
                    string indexKey = (string)valuesDic.Key;

                    if (IndexTable.Contains(indexKey) || IndexTable.Contains(indexKey = ConvertToNamedTagKey(indexKey)))
                    {
                        IIndexStore store = IndexTable[indexKey] as IIndexStore;
                        object      val   = valuesDic.Value;

                        if (val != null)
                        {
                            store.Remove(val, key);
                        }
                        else
                        {
                            store.Remove("null", key);
                        }

                        if (store.Count == 0)
                        {
                            if (indexKey == TAG_INDEX_KEY || IsNamedTagKey(indexKey))
                            {
                                IndexTable.Remove(indexKey);
                            }
                            else
                            {
                                IndexTable[indexKey] = new HashStore();
                            }
                        }
                    }
                }
            }
        }
Beispiel #7
0
        public virtual void RemoveFromIndex(object key)
        {
            bool             isNodeRemoved = false;
            IndexInformation indexInfo     = (IndexInformation)_keyIndexTable[key];

            if (indexInfo != null)
            {
                foreach (IndexStoreInformation indexStoreInfo in indexInfo.IndexStoreInformations)
                {
                    isNodeRemoved = false;
                    IIndexStore store = indexStoreInfo.Store;
                    if (indexStoreInfo.IndexPosition != null)
                    {
                        long prevSize = store.IndexInMemorySize;
                        isNodeRemoved        = store.Remove(key, indexStoreInfo.IndexPosition);
                        _attributeIndexSize += store.IndexInMemorySize - prevSize;
                    }
                }
                _keyIndexInformationSize -= indexInfo.IndexInMemorySize;
            }

            _keyIndexTable.Remove(key);
        }