public override void AddUserToCache(IUser user) { if (user != null && MinutesInCache > 0) { lock (padlock) { if (cachedUsers.Contains(user)) { RemoveUserFromCache(user); } // Truncate cache if it has grown out of size. if (MaxUsersInCache != 0 && cachedUsers.Count >= MaxUsersInCache) { TruncateCache(); } user.MakeReadOnly(); var cacheMapId = new CacheMapId(user.UserName, user.Domain); var cachedUser = new CachedUser(user); cachedMap.Add(cacheMapId, cachedUser); cachedUsers.Add(user); } } }
public override void AddUserToCache(IUser user) { if(user != null && MinutesInCache > 0) { lock(padlock) { if(cachedUsers.Contains(user)) { RemoveUserFromCache(user); } // Truncate cache if it has grown out of size. if(MaxUsersInCache != 0 && cachedUsers.Count >= MaxUsersInCache) { TruncateCache(); } user.MakeReadOnly(); var cacheMapId = new CacheMapId(user.UserName, user.Domain); var cachedUser = new CachedUser(user); cachedMap.Add(cacheMapId, cachedUser); cachedUsers.Add(user); } } }