Example #1
0
        /// <summary>
        /// Creates a new <see cref="DistributedCacheTagHelperService"/>.
        /// </summary>
        /// <param name="storage">The <see cref="DistributedCacheTagHelper"/>'s <see cref="IDistributedCacheTagHelperStorage"/>.</param>
        /// <param name="formatter">The <see cref="IDistributedCacheTagHelperFormatter"/> for cache value serialization.</param>
        /// <param name="HtmlEncoder">The <see cref="HtmlEncoder"/> used to encode cache content.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
        public DistributedCacheTagHelperService(
            IDistributedCacheTagHelperStorage storage,
            IDistributedCacheTagHelperFormatter formatter,
            HtmlEncoder HtmlEncoder,
            ILoggerFactory loggerFactory)
        {
            if (storage == null)
            {
                throw new ArgumentNullException(nameof(storage));
            }

            if (formatter == null)
            {
                throw new ArgumentNullException(nameof(formatter));
            }

            if (HtmlEncoder == null)
            {
                throw new ArgumentNullException(nameof(HtmlEncoder));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _formatter   = formatter;
            _storage     = storage;
            _htmlEncoder = HtmlEncoder;
            _logger      = loggerFactory.CreateLogger <DistributedCacheTagHelperService>();
            _workers     = new ConcurrentDictionary <CacheTagKey, Task <IHtmlContent> >();
        }
Example #2
0
        public DistributedCacheTagHelperService(
            IDistributedCacheTagHelperStorage storage,
            IDistributedCacheTagHelperFormatter formatter,
            HtmlEncoder HtmlEncoder
            )
        {
            _formatter   = formatter;
            _storage     = storage;
            _htmlEncoder = HtmlEncoder;

            _workers = new ConcurrentDictionary <string, Task <IHtmlContent> >();
        }