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; }
public CacheScopeImpl(SparkViewBase view, string identifier, CacheExpires expires) { _identifier = identifier; _expires = expires; _previousCacheScope = view._currentCacheScope; _cacheService = view.CacheService ?? _nullCacheService; _originator = new CacheOriginator(view.SparkViewContext); }
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); }
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); } }
public void Store(string identifier, CacheExpires expires, ICacheSignal signal, object item) { }
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; }
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); }