• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MeltyPlayer / MeltyTool / 19622977055

24 Nov 2025 04:05AM UTC coverage: 41.989% (+2.1%) from 39.89%
19622977055

push

github

MeltyPlayer
Switched float precision to fix broken tests.

6747 of 18131 branches covered (37.21%)

Branch coverage included in aggregate %.

28639 of 66144 relevant lines covered (43.3%)

65384.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/FinModelUtility/Fin/Fin/src/data/ReferenceCountCacheDictionary.cs
1
using System;
2
using System.Collections.Concurrent;
3
using System.Collections.Generic;
4

5
namespace fin.data;
6

7
public interface IReferenceCountCacheDictionary<in TKey, out TValue> {
8
  public TValue GetAndIncrement(TKey key);
9
  public void DecrementAndMaybeDispose(TKey key);
10
}
11

12
public sealed class ReferenceCountCacheDictionary<TKey, TValue>(
×
13
    Func<TKey, TValue> createHandler,
×
14
    Action<TKey, TValue>? disposeHandler = null)
×
15
    : IReferenceCountCacheDictionary<TKey, TValue>
16
    where TKey : notnull {
17
  private readonly ConcurrentDictionary<TKey, (TValue value, int count)> impl_
×
18
      = new();
×
19

20
  public TValue GetAndIncrement(TKey key) {
×
21
    var valueAndCount = this.impl_.GetOrAdd(key, _ => (createHandler(key), 0));
×
22
    valueAndCount.count++;
×
23
    return valueAndCount.value;
×
24
  }
×
25

26
  public void DecrementAndMaybeDispose(TKey key) {
×
27
    if (this.impl_.TryGetValue(key, out var valueAndCount)) {
×
28
      if (--valueAndCount.count <= 0) {
×
29
        this.impl_.Remove(key, out _);
×
30
        disposeHandler?.Invoke(key, valueAndCount.value);
×
31
      }
×
32
    }
×
33
  }
×
34
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc