Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CORECacheDependency"/> class that monitors an array of paths (to files or directories),
 /// an array of cache keys, or both for changes.
 /// It also makes itself dependent upon another instance of the <see cref="CORECacheDependency"/> class and a time when the change monitoring begins.
 /// </summary>
 /// <param name="filenames">The filenames.</param>
 /// <param name="cachekeys">The cachekeys.</param>
 /// <param name="dependency">The dependency.</param>
 /// <param name="start">The start.</param>
 public CORECacheDependency(string[] filenames, string[] cachekeys, CORECacheDependency dependency, DateTime start)
 {
     _utcStart        = start.ToUniversalTime();
     _fileNames       = filenames;
     _cacheKeys       = cachekeys;
     _cacheDependency = dependency;
 }
Exemple #2
0
 //Method that does the actual disposal of resources
 protected virtual void Dispose(bool disposing)
 {
     if ((disposing))
     {
         if (_cacheDependency != null)
         {
             _cacheDependency.Dispose(disposing);
         }
         if (_systemCacheDependency != null)
         {
             _systemCacheDependency.Dispose();
         }
         _fileNames             = null;
         _cacheKeys             = null;
         _cacheDependency       = null;
         _systemCacheDependency = null;
     }
 }
Exemple #3
0
        public override void Insert(string cacheKey, object itemToCache, CORECacheDependency dependency, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority,
                                    CacheItemRemovedCallback onRemoveCallback)
        {
            //initialize cache dependency
            CORECacheDependency d = dependency;

            //if web farm is enabled
            if (IsWebFarm())
            {
                //get hashed file name
                var f = new string[1];
                f[0] = GetFileName(cacheKey);
                //create a cache file for item
                CreateCacheFile(f[0], cacheKey);
                //create a cache dependency on the cache file
                d = new CORECacheDependency(f, null, dependency);
            }

            //Call base class method to add obect to cache
            base.Insert(cacheKey, itemToCache, d, absoluteExpiration, slidingExpiration, priority, onRemoveCallback);
        }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CORECacheDependency"/> classthat monitors an array of paths (to files or directories),
 /// an array of cache keys, or both for changes. It also makes itself dependent upon a separate instance of the <see cref="CORECacheDependency"/> class.
 /// </summary>
 /// <param name="filenames">The filenames.</param>
 /// <param name="cachekeys">The cachekeys.</param>
 /// <param name="dependency">The dependency.</param>
 public CORECacheDependency(string[] filenames, string[] cachekeys, CORECacheDependency dependency)
 {
     _fileNames       = filenames;
     _cacheKeys       = cachekeys;
     _cacheDependency = dependency;
 }
Exemple #5
0
 /// <summary>
 /// Inserts the specified cache key.
 /// </summary>
 /// <param name="cacheKey">The cache key.</param>
 /// <param name="itemToCache">The value.</param>
 /// <param name="dependency">The dependency.</param>
 /// <param name="absoluteExpiration">The absolute expiration.</param>
 /// <param name="slidingExpiration">The sliding expiration.</param>
 /// <param name="priority">The priority.</param>
 /// <param name="onRemoveCallback">The on remove callback.</param>
 public virtual void Insert(string cacheKey, object itemToCache, CORECacheDependency dependency, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority,
                            CacheItemRemovedCallback onRemoveCallback)
 {
     Cache.Insert(cacheKey, itemToCache, dependency == null ? null : dependency.SystemCacheDependency, absoluteExpiration, slidingExpiration, priority, onRemoveCallback);
 }
Exemple #6
0
 /// <summary>
 /// Inserts the specified cache key.
 /// </summary>
 /// <param name="cacheKey">The cache key.</param>
 /// <param name="itemToCache">The object.</param>
 /// <param name="dependency">The dependency.</param>
 /// <param name="absoluteExpiration">The absolute expiration.</param>
 /// <param name="slidingExpiration">The sliding expiration.</param>
 public virtual void Insert(string cacheKey, object itemToCache, CORECacheDependency dependency, DateTime absoluteExpiration, TimeSpan slidingExpiration)
 {
     Insert(cacheKey, itemToCache, dependency, absoluteExpiration, slidingExpiration, CacheItemPriority.Default, null);
 }
Exemple #7
0
 /// <summary>
 /// Inserts the specified cache key.
 /// </summary>
 /// <param name="cacheKey">The cache key.</param>
 /// <param name="itemToCache">The object.</param>
 /// <param name="dependency">The dependency.</param>
 public virtual void Insert(string cacheKey, object itemToCache, CORECacheDependency dependency)
 {
     Insert(cacheKey, itemToCache, dependency, System.Web.Caching.Cache.NoAbsoluteExpiration, System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.Default, null);
 }