private void AddUserToCachedUsers(NAAS_USRMGR.UserAccountType userAccount) { try { OrderedSet <CachedUserAccountInfo> userAccounts = GetAllUserAccounts(false); CachedUserAccountInfo cachedInfo = new CachedUserAccountInfo(userAccount); userAccounts.Add(cachedInfo); _objectCacheDao.CacheObjectKeepExpiration(userAccounts, CACHE_NAAS_USER_ACCOUNTS); } catch (Exception) { InvalidateCachedUserAccounts(); } }
private void RemoveUserFromCachedUsers(string userName) { try { OrderedSet <CachedUserAccountInfo> userAccounts = GetAllUserAccounts(false); CachedUserAccountInfo cachedInfo = new CachedUserAccountInfo(userName); bool didRemove = userAccounts.Remove(cachedInfo); if (didRemove) { _objectCacheDao.CacheObjectKeepExpiration(userAccounts, CACHE_NAAS_USER_ACCOUNTS); } } catch (Exception) { InvalidateCachedUserAccounts(); } }