Example #1
0
        public RequestLogger GetLogger(string ipAddress, bool createIfNotFound)
        {
            RequestLogger logger = null;

            lock (this)
            {
                bool found = loggerDictionary.TryGetValue(ipAddress, out logger);
                if (!found && createIfNotFound)
                {
                    logger = new RequestLogger();
                    loggerDictionary.Add(ipAddress, logger);
                }
            }
            return(logger);
        }
Example #2
0
        internal void Expire(int expirationInterval)
        {
            ICollection <string> ipAddressList = null;

            lock (this)
            {
                ipAddressList = loggerDictionary.Keys;
            }

            foreach (string ipAddress in ipAddressList)
            {
                RequestLogger logger = null;
                bool          found  = loggerDictionary.TryGetValue(ipAddress, out logger);

                if (found)
                {
                    logger.Expire(expirationInterval);
                }
            }
        }