/// <summary>
        /// Sets the file watch expiration.
        /// </summary>
        /// <param name="options">The options.</param>
        /// <param name="fileName">Name of the file.</param>
        /// <returns>DistributedCacheEntryOptions2.</returns>
        public static DistributedCacheEntryOptions2 SetFileWatchExpiration(this DistributedCacheEntryOptions2 options, string fileName)
        {
            var fileInfo     = new FileInfo(fileName);
            var fileProvider = new PhysicalFileProvider(fileInfo.DirectoryName);

            options.AddExpirationToken(fileProvider.Watch(fileInfo.Name));
            return(options);
        }
 /// <summary>
 /// Forces the absolute expiration.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="delay">The delay.</param>
 /// <returns>DistributedCacheEntryOptions.</returns>
 public static DistributedCacheEntryOptions2 ForceAbsoluteExpiration(this DistributedCacheEntryOptions2 options, TimeSpan delay) =>
 options.AddExpirationToken(new CancellationChangeToken(new CancellationTokenSource(delay).Token));
 /// <summary>
 /// Sets the cache entry change expiration.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="cache">The cache.</param>
 /// <param name="key">The key.</param>
 /// <returns>DistributedCacheEntryOptions2.</returns>
 public static DistributedCacheEntryOptions2 SetCacheEntryChangeExpiration(this DistributedCacheEntryOptions2 options, IDistributedCache cache, string key)
 {
     options.AddExpirationToken(MakeCacheEntryChangeToken(cache, new[] { key }));
     return(options);
 }