Example #1
0
        private static bool IsSimpleCaching(CacheExpires expires, ICacheSignal signal)
        {
            // signal provided - complex caching
            if (signal != null)
                return false;

            // no signal, no expires - simple caching
            if (expires == null)
                return true;

            // expires absolute has meaningful value - complex caching
            if (expires.Absolute != CacheExpires.NoAbsoluteExpiration &&
                expires.Absolute != DateTime.MaxValue)
            {
                return false;
            }

            // expires sliding has meaningful value - complex caching
            if (expires.Sliding != CacheExpires.NoSlidingExpiration &&
                expires.Sliding != TimeSpan.MaxValue &&
                expires.Sliding != TimeSpan.Zero)
            {
                return false;
            }

            // no signal, no meaningful expires value - simple caching
            return true;
        }
Example #2
0
 public CacheScopeImpl(SparkViewBase view, string identifier, CacheExpires expires)
 {
     _identifier         = identifier;
     _expires            = expires;
     _previousCacheScope = view._currentCacheScope;
     _cacheService       = view.CacheService ?? _nullCacheService;
     _originator         = new CacheOriginator(view.SparkViewContext);
 }
Example #3
0
 protected bool BeginCachedContent(string site, CacheExpires expires, params object[] key)
 {
     this._currentCacheScope = new CacheScopeImpl(this, CacheUtilities.ToIdentifier(site, key), expires);
     if (this._currentCacheScope.Begin())
     {
         return(true);
     }
     this.EndCachedContent();
     return(false);
 }
Example #4
0
 public void Store(string identifier, CacheExpires expires, ICacheSignal signal, object item)
 {
     if (IsSimpleCaching(expires, signal))
     {
         // use MR cache service for simple identifier-only caching
         _monorailCacheProvider.Store(identifier, item);
     }
     else
     {
         // use the httpcontext cache when storing with expires or signal args in effect
         _fallbackCacheService.Store(identifier, expires, signal, item);
     }
 }
Example #5
0
 public void Store(string identifier, CacheExpires expires, ICacheSignal signal, object item)
 {
 }
Example #6
0
 public CacheScopeImpl(SparkViewBase view, string identifier, CacheExpires expires)
 {
     _identifier = identifier;
     _expires = expires;
     _previousCacheScope = view._currentCacheScope;
     _cacheService = view.CacheService ?? _nullCacheService;
     _originator = new CacheOriginator(view.SparkViewContext);
 }
Example #7
0
        protected bool BeginCachedContent(string site, CacheExpires expires, params object[] key)
        {
            _currentCacheScope = new CacheScopeImpl(this, CacheUtilities.ToIdentifier(site, key), expires);
            if (_currentCacheScope.Begin())
                return true;

            EndCachedContent();
            return false;
        }
Example #8
0
 public void Store(string identifier, CacheExpires expires, ICacheSignal signal, object item)
 {
 }
 public void Store(string identifier, Spark.CacheExpires expires, ICacheSignal signal, object item)
 {
     this._cache.Insert(identifier, item, SignalDependency.For(signal), (expires ?? Spark.CacheExpires.Empty).Absolute, (expires ?? Spark.CacheExpires.Empty).Sliding);
 }