public async Task Invalidate()
 {
     using (await valueLock.LockAsync().ConfigureAwait(false))
     {
         _value = default;
     }
 }
示例#2
0
 public async Task Invalidate(CancellationToken cancellationToken = default)
 {
     using (await _valueLock.LockAsync(cancellationToken).ConfigureAwait(false))
     {
         _value = default;
     }
 }
        public async Task <T> Value()
        {
            using (await valueLock.LockAsync().ConfigureAwait(false))
            {
                if (IsValueCreatedInternal)
                {
                    return(_value.Result);
                }

                _value = await _valueProvider(_value).ConfigureAwait(false);

                return(_value.Result);
            }
        }
示例#4
0
        public async Task <T> Value(CancellationToken cancellationToken = default)
        {
            using (await _valueLock.LockAsync(cancellationToken).ConfigureAwait(false))
            {
                if (IsValueCreatedInternal)
                {
                    return(_value.Result);
                }

                _value = await _valueProvider(_value).ConfigureAwait(false);

                return(_value.Result);
            }
        }