public List <TelegramUser> GetUser(int telegramId) { var key = string.Format(SingleKeyFormat, telegramId); var users = Cache.Get <List <TelegramUser> >(key); if (users != null) { return(users); } users = TgDao.GetUser(telegramId); if (users.Any()) { Cache.Insert(key, users, Expiration); } return(users); }
public TelegramUser GetUser(Guid userId, int tenantId) { var key = string.Format(PairKeyFormat, userId, tenantId); var user = Cache.Get <TelegramUser>(key); if (user != null) { return(user); } user = TgDao.GetUser(userId, tenantId); if (user != null) { Cache.Insert(key, user, Expiration); } return(user); }