/// <inheritdoc />
        public override async Task InvokeAsync(ILoadingContext <TSource> context, LoadingPipeDelegate <TSource> next, CancellationToken cancellationToken = default)
        {
            if (IsInDesignMode)
            {
                await next(context, cancellationToken);

                return;
            }

            var uri = context.Current as Uri;

            if (uri == null || !uri.IsHttp())
            {
                await next(context, cancellationToken);

                return;
            }

            var cacheKey = uri.AbsoluteUri;

            if (await _diskCache.IsExistAsync(cacheKey))
            {
                context.Current = await _diskCache.GetAsync(cacheKey, cancellationToken);

                try
                {
                    await next(context, cancellationToken);
                }
                catch
                {
                    _diskCache.DeleteAsync(cacheKey).Ignore();
                    throw;
                }
            }
            else
            {
                await next(context, cancellationToken);

                var bytes = context.HttpResponseBytes;
                if (bytes != null)
                {
                    _diskCache.SetAsync(cacheKey, bytes, CancellationToken.None).Ignore();
                }
            }
        }