/// <summary> /// Returns an instance of a streamn with mentions. Mentions are cached /// </summary> /// <param name="user">The user that is mentioned</param> /// <param name="conn">The connection on which to retreive the mentions</param> /// <returns></returns> public static async Task<Mentions> InstanciateMentionsAsync(User user, Connection conn) { if (!streamCache.ContainsKey(user.UserId)) { Mentions m = new Mentions(user); Post[] initialPosts = await conn.GetMentionsAsync(user.UserId); foreach (Post p in initialPosts) m.posts.Add(p); streamCache.Add(user.UserId, m); } return streamCache[user.UserId]; }
/// <summary> /// Returns an instance of a streamn with mentions. Mentions are cached /// </summary> /// <param name="user">The user that is mentioned</param> /// <param name="conn">The connection on which to retreive the mentions</param> /// <returns></returns> public static async Task <Mentions> InstanciateMentionsAsync(User user, Connection conn) { if (!streamCache.ContainsKey(user.UserId)) { Mentions m = new Mentions(user); Post[] initialPosts = await conn.GetMentionsAsync(user.UserId); foreach (Post p in initialPosts) { m.posts.Add(p); } streamCache.Add(user.UserId, m); } return(streamCache[user.UserId]); }