internal AutoWebProxyScriptEngine(WebProxy proxy, bool useRegistry) { webProxy = proxy; m_UseRegistry = useRegistry; backupCache = new SingleItemRequestCache(RequestCacheManager.IsCachingEnabled); }
private MetadataUpdateStream(Stream parentStream, RequestCache cache, string key, bool isStrictCacheErrors) : base(parentStream) { this.m_Cache = cache; this.m_Key = key; this.m_CacheDestroy = true; this.m_IsStrictCacheErrors = isStrictCacheErrors; }
internal MetadataUpdateStream(Stream parentStream, RequestCache cache, string key, DateTime expiresGMT, DateTime lastModifiedGMT, DateTime lastSynchronizedGMT, TimeSpan maxStale, StringCollection entryMetadata, StringCollection systemMetadata, bool isStrictCacheErrors) : base(parentStream) { this.m_Cache = cache; this.m_Key = key; this.m_Expires = expiresGMT; this.m_LastModified = lastModifiedGMT; this.m_LastSynchronized = lastSynchronizedGMT; this.m_MaxStale = maxStale; this.m_EntryMetadata = entryMetadata; this.m_SystemMetadata = systemMetadata; this.m_IsStrictCacheErrors = isStrictCacheErrors; }
internal MetadataUpdateStream(Stream parentStream, RequestCache cache, string key, DateTime expiresGMT, DateTime lastModifiedGMT, DateTime lastSynchronizedGMT, TimeSpan maxStale, StringCollection entryMetadata, StringCollection systemMetadata, bool isStrictCacheErrors) : base(parentStream) { m_Cache = cache; m_Key = key; m_Expires = expiresGMT; m_LastModified = lastModifiedGMT; m_LastSynchronized = lastSynchronizedGMT; m_MaxStale = maxStale; m_EntryMetadata = entryMetadata; m_SystemMetadata = systemMetadata; m_IsStrictCacheErrors = isStrictCacheErrors; }
internal RequestCachingSectionInternal(RequestCachingSection section) { if (!section.DisableAllCaching) { this.defaultCachePolicy = new RequestCachePolicy(section.DefaultPolicyLevel); this.isPrivateCache = section.IsPrivateCache; this.unspecifiedMaximumAge = section.UnspecifiedMaximumAge; } else { this.disableAllCaching = true; } this.httpRequestCacheValidator = new HttpRequestCacheValidator(false, this.UnspecifiedMaximumAge); this.ftpRequestCacheValidator = new FtpRequestCacheValidator(false, this.UnspecifiedMaximumAge); this.defaultCache = new WinInetCache(this.IsPrivateCache, true, true); if (!section.DisableAllCaching) { HttpCachePolicyElement defaultHttpCachePolicy = section.DefaultHttpCachePolicy; if (defaultHttpCachePolicy.WasReadFromConfig) { if (defaultHttpCachePolicy.PolicyLevel == HttpRequestCacheLevel.Default) { HttpCacheAgeControl cacheAgeControl = (defaultHttpCachePolicy.MinimumFresh != TimeSpan.MinValue) ? HttpCacheAgeControl.MaxAgeAndMinFresh : HttpCacheAgeControl.MaxAgeAndMaxStale; this.defaultHttpCachePolicy = new HttpRequestCachePolicy(cacheAgeControl, defaultHttpCachePolicy.MaximumAge, (defaultHttpCachePolicy.MinimumFresh != TimeSpan.MinValue) ? defaultHttpCachePolicy.MinimumFresh : defaultHttpCachePolicy.MaximumStale); } else { this.defaultHttpCachePolicy = new HttpRequestCachePolicy(defaultHttpCachePolicy.PolicyLevel); } } FtpCachePolicyElement defaultFtpCachePolicy = section.DefaultFtpCachePolicy; if (defaultFtpCachePolicy.WasReadFromConfig) { this.defaultFtpCachePolicy = new RequestCachePolicy(defaultFtpCachePolicy.PolicyLevel); } } }
// internal string[] ResponseMetadata {get {return _ResponseMetadata;}} // internal string CacheRetrieveKey {get {return _CacheRetrieveKey;}} // internal string CacheStoreKey {get {return _CacheStoreKey;}} // // Public methods // internal RequestCacheProtocol(RequestCache cache, RequestCacheValidator defaultValidator) { _RequestCache = cache; _Validator = defaultValidator; _CanTakeNewRequest = true; }
internal RequestCacheBinding(RequestCache requestCache, RequestCacheValidator cacheValidator, RequestCachePolicy policy) { this.m_RequestCache = requestCache; this.m_CacheValidator = cacheValidator; this.m_Policy = policy; }
internal RequestCacheBinding(RequestCache requestCache, RequestCacheValidator cacheValidator, RequestCachePolicy policy) { m_RequestCache = requestCache; m_CacheValidator = cacheValidator; m_Policy = policy; }
// // This constructor will result in removing a cache entry upon closure // private MetadataUpdateStream( Stream parentStream, RequestCache cache, string key, bool isStrictCacheErrors):base() { if (parentStream == null) throw new ArgumentNullException("parentStream"); m_ParentStream = parentStream; m_Cache = cache; m_Key = key; m_CacheDestroy = true; m_IsStrictCacheErrors = isStrictCacheErrors; }
internal MetadataUpdateStream( Stream parentStream, RequestCache cache, string key, DateTime expiresGMT, DateTime lastModifiedGMT, DateTime lastSynchronizedGMT, TimeSpan maxStale, StringCollection entryMetadata, StringCollection systemMetadata, bool isStrictCacheErrors): base() { if (parentStream == null) throw new ArgumentNullException("parentStream"); m_ParentStream = parentStream; m_Cache = cache; m_Key = key; m_Expires = expiresGMT; m_LastModified = lastModifiedGMT; m_LastSynchronized = lastSynchronizedGMT; m_MaxStale = maxStale; m_EntryMetadata = entryMetadata; m_SystemMetadata = systemMetadata; m_IsStrictCacheErrors = isStrictCacheErrors; }
protected virtual void Dispose(bool disposing, CloseExState closeState) { if (Interlocked.Increment(ref _Disposed) == 1) { ICloseEx icloseEx = m_ParentStream as ICloseEx; if (icloseEx != null) { icloseEx.CloseEx(closeState); } else { m_ParentStream.Close(); } if (m_CacheDestroy) { if (m_IsStrictCacheErrors) { m_Cache.Remove(m_Key); } else { m_Cache.TryRemove(m_Key); } } else { if (m_IsStrictCacheErrors) { m_Cache.Update(m_Key, m_Expires, m_LastModified, m_LastSynchronized, m_MaxStale, m_EntryMetadata, m_SystemMetadata); } else { m_Cache.TryUpdate(m_Key, m_Expires, m_LastModified, m_LastSynchronized, m_MaxStale, m_EntryMetadata, m_SystemMetadata); } } if (!disposing) { m_Cache = null; m_Key = null; m_EntryMetadata = null; m_SystemMetadata = null; } } base.Dispose(disposing); }
public NetWebProxyFinder(AutoWebProxyScriptEngine engine) : base(engine) { backupCache = new SingleItemRequestCache(RequestCacheManager.IsCachingEnabled); lockObject = new object(); }