예제 #1
0
        UserCacheEntry AddUserToCache(User user)
        {
            UserCacheEntry cacheentry = new UserCacheEntry(user);

            usersbyname[new UserKey(user.Service, user.Name)] = cacheentry;
            usersbyid[user.ID] = cacheentry;
            users.Add(new UserCacheEntry(user));
            return(cacheentry);
        }
예제 #2
0
 void ITimerService.Process(double time)
 {
     lock (userlock) {
         for (int i = users.Count - 1; i >= 0; --i)
         {
             UserCacheEntry user = users[i];
             user.LifeTime -= time;
             if (user.LifeTime <= 0.0)
             {
                 usersbyname.Remove(new UserKey(user.User.Service, user.User.Name));
                 usersbyid.Remove(user.User.ID);
                 users.RemoveAt(i);
             }
         }
     }
 }