示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 static internal IEnumerable <Discussion> GetDiscussions(MergeRequestKey mrk,
                                                         CachedDiscussionsTimestamp cachedRevisionTimestamp)
 {
     return(getCachedDiscussions(mrk, cachedRevisionTimestamp));
 }