コード例 #1
0
ファイル: StatsCollection.cs プロジェクト: madhon/ostrich
        public long Increment(string[] names, int count)
        {
            long answer = 0;

            foreach (var name in names)
            {
                var lowerName = name.ToLower();
                var counter   = new AtomicLong(count);
                answer = counters.AddOrUpdate(lowerName, counter, (k, v) => new AtomicLong(v.Value + counter.Value)).Value;
            }

            return(answer);
        }
コード例 #2
0
ファイル: AtomicLong.cs プロジェクト: madhon/ostrich
        public bool Equals(AtomicLong other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(other.value == value);
        }