Пример #1
0
        public void AddIfNeeded(uint GroupId, ClientMessage Request, ServerMessage Response)
        {
            lock (mCachedResponses)
            {
                foreach (ResponseCacheItem Item in mCachedResponses)
                {
                    if (Item.GroupId == GroupId && Item.Request.ToString() == Request.ToString())
                    {
                        return;
                    }
                }

                ResponseCacheItem NewItem = new ResponseCacheItem(GroupId, Request, Response);
                mCachedResponses.Add(NewItem);
            }
        }
Пример #2
0
        public void AddIfNeeded(uint GroupId, ClientMessage Request, ServerMessage Response)
        {
            lock (mCachedResponses)
            {
                foreach (ResponseCacheItem Item in mCachedResponses)
                {
                    if (Item.GroupId == GroupId && Item.Request.ToString() == Request.ToString())
                    {
                        return;
                    }
                }

                ResponseCacheItem NewItem = new ResponseCacheItem(GroupId, Request, Response);
                mCachedResponses.Add(NewItem);
            }
        }
Пример #3
0
        public void AddIfNeeded(uint GroupId, ClientMessage Request, ServerMessage Response)
        {
            lock (mCachedResponses)
            {
                if (mCachedResponses.Count > mCacheMaxCapacity)
                {
                    // capacity has been reached, to protect overflow remove the oldest element in the cache immediatly..
                    mCachedResponses.RemoveAt(mCachedResponses.Count - 1);
                }

                foreach (ResponseCacheItem Item in mCachedResponses)
                {
                    if (Item.GroupId == GroupId && Item.Request.ToString() == Request.ToString())
                    {
                        return;
                    }
                }

                ResponseCacheItem NewItem = new ResponseCacheItem(GroupId, Request, Response);
                mCachedResponses.Add(NewItem);
            }
        }
Пример #4
0
        public void AddIfNeeded(uint GroupId, ClientMessage Request, ServerMessage Response)
        {
            lock (mCachedResponses)
            {
                if (mCachedResponses.Count > mCacheMaxCapacity)
                {
                    // capacity has been reached, to protect overflow remove the oldest element in the cache immediatly..
                    mCachedResponses.RemoveAt(mCachedResponses.Count - 1);
                }

                foreach (ResponseCacheItem Item in mCachedResponses)
                {
                    if (Item.GroupId == GroupId && Item.Request.ToString() == Request.ToString())
                    {
                        return;
                    }
                }

                ResponseCacheItem NewItem = new ResponseCacheItem(GroupId, Request, Response);
                mCachedResponses.Add(NewItem);
            }
        }