Beispiel #1
0
 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();
 }
Beispiel #2
0
        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));
            }
        }
Beispiel #3
0
 public bool TryGetFile(string fileName, string transferEncoding, out CachableFileInfo fileInfo)
 {
     lock (cache)
         return(cache.TryGetValue(new Tuple <string, string>(fileName, transferEncoding), out fileInfo));
 }