public static UpdateHandler CreateAndRun(IncrementalCachedObject <T, TUpdates> parent)
            {
                var updateHandler = new UpdateHandler(parent);

                Task.Run(updateHandler.Run);
                return(updateHandler);
            }
 private UpdateHandler(IncrementalCachedObject <T, TUpdates> parent)
 {
     _parent  = parent;
     _tcsList = new List <TaskCompletionSource <bool> >();
     _cts     = new CancellationTokenSource();
     _cancellationRegistration = _parent._isDisposedCancellationTokenSource.Token.Register(() => _cts.Cancel());
 }
        public new IIncrementalCachedObject <T, TUpdates> Build()
        {
            var refreshIntervalFactory = GetRefreshIntervalFactory();
            var updateIntervalFactory  = GetUpdateIntervalFactory();

            var cachedObject = new IncrementalCachedObject <T, TUpdates>(
                _getValueFunc,
                _getUpdatesFunc,
                _applyUpdatesFunc,
                refreshIntervalFactory,
                updateIntervalFactory,
                _refreshValueFuncTimeout);

            AddOnInitializedAction(cachedObject, _onInitializedAction);
            AddOnDisposedAction(cachedObject, _onDisposedAction);
            AddOnValueRefreshedActions(cachedObject);
            AddOnValueUpdatedActions(cachedObject);

            return(cachedObject);
        }