internal virtual string ToString(bool verbose) {
StringBuilder sb = new StringBuilder(512);
sb.Append("\r\nIsPrivateEntry = ").Append(IsPrivateEntry);
sb.Append("\r\nIsPartialEntry = ").Append(IsPartialEntry);
sb.Append("\r\nStreamSize = ").Append(StreamSize);
sb.Append("\r\nExpires = ").Append(ExpiresUtc == DateTime.MinValue? "": ExpiresUtc.ToString("r", CultureInfo.CurrentCulture));
sb.Append("\r\nLastAccessed = ").Append(LastAccessedUtc == DateTime.MinValue? "": LastAccessedUtc.ToString("r", CultureInfo.CurrentCulture));
sb.Append("\r\nLastModified = ").Append(LastModifiedUtc == DateTime.MinValue? "": LastModifiedUtc.ToString("r", CultureInfo.CurrentCulture));
sb.Append("\r\nLastSynchronized = ").Append(LastSynchronizedUtc == DateTime.MinValue? "": LastSynchronizedUtc.ToString("r", CultureInfo.CurrentCulture));
sb.Append("\r\nMaxStale(sec) = ").Append(MaxStale == TimeSpan.MinValue? "": ((int)MaxStale.TotalSeconds).ToString(NumberFormatInfo.CurrentInfo));
sb.Append("\r\nHitCount = ").Append(HitCount.ToString(NumberFormatInfo.CurrentInfo));
sb.Append("\r\nUsageCount = ").Append(UsageCount.ToString(NumberFormatInfo.CurrentInfo));
sb.Append("\r\n");
if (verbose) {
sb.Append("EntryMetadata:\r\n");
if (m_EntryMetadata != null) {
foreach (string s in m_EntryMetadata) {
sb.Append(s).Append("\r\n");
}
}
sb.Append("---\r\nSystemMetadata:\r\n");
if (m_SystemMetadata != null) {
foreach (string s in m_SystemMetadata) {
sb.Append(s).Append("\r\n");
}
}
}
return sb.ToString();
}
}
// // // private void ValidateFreshness(RequestCacheEntry fetchEntry) { _Validator.FetchCacheEntry(fetchEntry); if (_Validator.CacheStream == null || _Validator.CacheStream == Stream.Null) { if (Logging.On) { Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_entry_not_found_freshness_undefined, "ValidateFreshness()")); } _Validator.SetFreshnessStatus(CacheFreshnessStatus.Undefined); return; } if (Logging.On) { if (Logging.IsVerbose(Logging.RequestCache)) { Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_dumping_cache_context)); if (fetchEntry == null) { Logging.PrintInfo(Logging.RequestCache, "<null>"); } else { string[] context = fetchEntry.ToString(Logging.IsVerbose(Logging.RequestCache)).Split(RequestCache.LineSplits); for (int i = 0; i < context.Length; ++i) { if (context[i].Length != 0) { Logging.PrintInfo(Logging.RequestCache, context[i]); } } } } } CacheFreshnessStatus result = _Validator.ValidateFreshness(); _Validator.SetFreshnessStatus(result); _IsCacheFresh = result == CacheFreshnessStatus.Fresh; if (Logging.On) { Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_result, "ValidateFreshness()", result.ToString())); } }