コード例 #1
0
        internal void Remove(UserConfigurationName configName, StoreObjectId folderId)
        {
            LinkedListNode <UserConfigurationCacheEntry> linkedListNode = this.userConfigCacheEntryList.First;

            lock (this.userConfigCacheEntryList)
            {
                while (linkedListNode != null)
                {
                    UserConfigurationCacheEntry value = linkedListNode.Value;
                    if (value.CheckMatch(configName.Name, folderId))
                    {
                        this.userConfigCacheEntryList.Remove(linkedListNode);
                        break;
                    }
                    linkedListNode = linkedListNode.Next;
                }
            }
        }
コード例 #2
0
        internal bool TryGetUserConfigurationCachedEntry(UserConfigurationName configName, StoreObjectId folderId, out UserConfigurationCacheEntry cacheEntry)
        {
            bool result;

            lock (this.userConfigCacheEntryList)
            {
                for (LinkedListNode <UserConfigurationCacheEntry> linkedListNode = this.userConfigCacheEntryList.First; linkedListNode != null; linkedListNode = linkedListNode.Next)
                {
                    UserConfigurationCacheEntry value = linkedListNode.Value;
                    if (value.CheckMatch(configName.Name, folderId))
                    {
                        cacheEntry = value;
                        return(true);
                    }
                }
                cacheEntry = null;
                result     = false;
            }
            return(result);
        }
コード例 #3
0
        internal void AddUserConfigurationCachedEntry(StoreObjectId folderId, string configName, StoreObjectId itemId, bool canCleanse)
        {
            UserConfigurationCacheEntry value = new UserConfigurationCacheEntry(configName, folderId, itemId);
            LinkedListNode <UserConfigurationCacheEntry> node = new LinkedListNode <UserConfigurationCacheEntry>(value);

            lock (this.userConfigCacheEntryList)
            {
                for (LinkedListNode <UserConfigurationCacheEntry> linkedListNode = this.userConfigCacheEntryList.First; linkedListNode != null; linkedListNode = linkedListNode.Next)
                {
                    UserConfigurationCacheEntry value2 = linkedListNode.Value;
                    if (value2.CheckMatch(configName, folderId))
                    {
                        linkedListNode.Value = value;
                        return;
                    }
                }
                if (canCleanse && this.userConfigCacheEntryList.Count > 32)
                {
                    this.userConfigCacheEntryList.RemoveLast();
                    ExTraceGlobals.UserConfigurationTracer.TraceDebug <int>((long)this.GetHashCode(), "UserConfigurationCache::Add. The cache has reached the capacity: {0} the last entry was removed.", 32);
                }
                this.userConfigCacheEntryList.AddFirst(node);
            }
        }