bool IFileCache.TryGetFile(string fileName, string transferEncoding, out CachableFileInfo fileInfo) { Contract.Requires(fileName != null); Contract.Ensures( (Contract.ValueAtReturn(out fileInfo) != null && Contract.Result <bool>() == true) || (Contract.ValueAtReturn(out fileInfo) == null && Contract.Result <bool>() == false)); throw new System.NotImplementedException(); }
public void CacheFile(string fileName, byte[] fileData, string transferEncoding = null) { lock (cache) cache[new Tuple <string, string>(fileName, transferEncoding)] = new CachableFileInfo(fileName, fileData, transferEncoding); if (log.IsDebugEnabled) { log.DebugFormat( CultureInfo.InvariantCulture, "Caching file '{0}' (transf. enc.='{1}'), {2} ({3} total cached files)", fileName, transferEncoding, FormattingUtils.FormatByteSizeRoundedToString(fileData.Length), FormattingUtils.FormatByteSizeRoundedToString(CachedFilesTotalSize)); } }
public bool TryGetFile(string fileName, string transferEncoding, out CachableFileInfo fileInfo) { lock (cache) return(cache.TryGetValue(new Tuple <string, string>(fileName, transferEncoding), out fileInfo)); }