private static IEnumerable <Discussion> getCachedDiscussions(MergeRequestKey mrk, CachedDiscussionsTimestamp cachedRevisionTimestamp) { if (!_discussions.TryGetValue(mrk, out var discussionCollection)) { return(null); } if (!discussionCollection.Data.TryGetTarget(out var target)) { return(null); } if (discussionCollection.Timestamp.Time != cachedRevisionTimestamp.Time) { return(null); } if (discussionCollection.Timestamp.Count != cachedRevisionTimestamp.Count) { return(null); } return(target); }
static internal void SetDiscussions(MergeRequestKey mrk, IEnumerable <Discussion> discussions, CachedDiscussionsTimestamp revisionTimestamp) { WeakReference <IEnumerable <Discussion> > weakDiscussions = new WeakReference <IEnumerable <Discussion> >(discussions); _discussions[mrk] = new TimedEntity <WeakReference <IEnumerable <Discussion> >, CachedDiscussionsTimestamp>( weakDiscussions, revisionTimestamp); }
static internal IEnumerable <Discussion> GetDiscussions(MergeRequestKey mrk, CachedDiscussionsTimestamp cachedRevisionTimestamp) { return(getCachedDiscussions(mrk, cachedRevisionTimestamp)); }