public CacheConfigInfo(string key, string dependencyType, string expirationTimeMinutes, string dependencyDatabasename, string dependencyTables) { this.key = key; this.dependencyType = ( CacheDependencyType )Convert.ToInt32(dependencyType); this.expirationTimeMinute = Convert.ToInt32(expirationTimeMinutes); this.dataBaseName = dependencyDatabasename; this.dependencyTables = dependencyTables; }
internal CacheDependency CreateCacheDependency(CacheDependencyType dependencyType, CacheDependency dependency) { if (this._dependencies != null) { if ((dependencyType == CacheDependencyType.Files) || (dependencyType == CacheDependencyType.CacheItems)) { foreach (ResponseDependencyInfo info in this._dependencies) { using (CacheDependency dependency2 = dependency) { if (dependencyType == CacheDependencyType.Files) { dependency = new CacheDependency(0, info.items, null, dependency2, info.utcDate); } else { dependency = new CacheDependency(null, info.items, dependency2, DateTimeUtil.ConvertToLocalTime(info.utcDate)); } } } return(dependency); } CacheDependency dependency3 = null; VirtualPathProvider virtualPathProvider = HostingEnvironment.VirtualPathProvider; if ((virtualPathProvider != null) && (this._requestVirtualPath != null)) { dependency3 = virtualPathProvider.GetCacheDependency(this._requestVirtualPath, this.GetDependencies(), this._oldestDependency); } if (dependency3 == null) { return(dependency); } AggregateCacheDependency dependency4 = new AggregateCacheDependency(); dependency4.Add(new CacheDependency[] { dependency3 }); if (dependency != null) { dependency4.Add(new CacheDependency[] { dependency }); } dependency = dependency4; } return(dependency); }
// Returns a dummy cache key for pages ("nodes") in the content tree // "nodes|<site name>|<generated class name>|< type of cached data >" // which is touched when pages are modified public string GetNodesCacheDependencyKey(string className, CacheDependencyType dependencyType) { return($"nodes|{SiteContextService.SiteName}|{className}|{dependencyType}".ToLowerInvariant()); }
internal CacheDependency CreateCacheDependency(CacheDependencyType dependencyType, CacheDependency dependency) { if (this._dependencies != null) { if ((dependencyType == CacheDependencyType.Files) || (dependencyType == CacheDependencyType.CacheItems)) { foreach (ResponseDependencyInfo info in this._dependencies) { using (CacheDependency dependency2 = dependency) { if (dependencyType == CacheDependencyType.Files) { dependency = new CacheDependency(0, info.items, null, dependency2, info.utcDate); } else { dependency = new CacheDependency(null, info.items, dependency2, DateTimeUtil.ConvertToLocalTime(info.utcDate)); } } } return dependency; } CacheDependency dependency3 = null; VirtualPathProvider virtualPathProvider = HostingEnvironment.VirtualPathProvider; if ((virtualPathProvider != null) && (this._requestVirtualPath != null)) { dependency3 = virtualPathProvider.GetCacheDependency(this._requestVirtualPath, this.GetDependencies(), this._oldestDependency); } if (dependency3 == null) { return dependency; } AggregateCacheDependency dependency4 = new AggregateCacheDependency(); dependency4.Add(new CacheDependency[] { dependency3 }); if (dependency != null) { dependency4.Add(new CacheDependency[] { dependency }); } dependency = dependency4; } return dependency; }
// The caller of this method must dispose the cache dependencies internal CacheDependency CreateCacheDependency(CacheDependencyType dependencyType, CacheDependency dependency) { if (_dependencies != null) { if (dependencyType == CacheDependencyType.Files || dependencyType == CacheDependencyType.CacheItems) { foreach (ResponseDependencyInfo info in _dependencies) { CacheDependency dependencyOld = dependency; try { if (dependencyType == CacheDependencyType.Files) { dependency = new CacheDependency(0, info.items, null, dependencyOld, info.utcDate); } else { // We create a "public" CacheDepdency here, since the keys are for public items. dependency = new CacheDependency(null, info.items, dependencyOld, DateTimeUtil.ConvertToLocalTime(info.utcDate)); } } finally { if (dependencyOld != null) { dependencyOld.Dispose(); } } } } else { CacheDependency virtualDependency = null; VirtualPathProvider vpp = HostingEnvironment.VirtualPathProvider; if (vpp != null && _requestVirtualPath != null) { virtualDependency = vpp.GetCacheDependency(_requestVirtualPath, GetDependencies(), _oldestDependency); } if (virtualDependency != null) { AggregateCacheDependency tempDep = new AggregateCacheDependency(); tempDep.Add(virtualDependency); if (dependency != null) { tempDep.Add(dependency); } dependency = tempDep; } } } return dependency; }