AsyncLockWithValue<T>
Primitive that combines async lock and value cache
public AsyncLockWithValue()
public ValueTask<LockOrValue<T>> GetLockOrValueAsync(bool async, CancellationToken cancellationToken = default)
Method that either returns cached value or acquire a lock.
If one caller has acquired a lock, other callers will be waiting for the lock to be released.
If value is set, lock is released and all waiters get that value.
If value isn't set, the next waiter in the queue will get the lock.