Inheritance: System.IO.FileStream
示例#1
0
 internal static void Recycle(FileReadStream stream)
 {
     try {
         var key = stream.Name;
         lock (streams) {
             CacheItem ignore;
             if (!streams.TryGetValue(key, out ignore) ||
                 Object.Equals(ignore.stream, stream))
             {
                 logger.DebugFormat("Recycling {0}", key);
                 stream.Seek(0, SeekOrigin.Begin);
                 var removed = streams.AddAndPop(key, new CacheItem(stream));
                 if (removed != null)
                 {
                     removed.stream.Kill();
                 }
                 return;
             }
         }
     }
     catch (Exception) {
         // no op
     }
     stream.Kill();
 }
示例#2
0
 internal static void Recycle(FileReadStream stream)
 {
     try {
     var key = stream.Name;
     lock (streams) {
       CacheItem ignore;
       if (!streams.TryGetValue(key, out ignore) ||
       Equals(ignore.Stream, stream)) {
     logger.DebugFormat("Recycling {0}", key);
     stream.Seek(0, SeekOrigin.Begin);
     var removed = streams.AddAndPop(key, new CacheItem(stream));
     removed?.Stream.Kill();
     return;
       }
     }
       }
       catch (Exception) {
     // no op
       }
       stream.Kill();
 }
示例#3
0
 public CacheItem(FileReadStream stream)
 {
     this.stream = stream;
     insertionPoint = DateTime.UtcNow;
 }
示例#4
0
 public CacheItem(FileReadStream stream)
 {
     Stream = stream;
 }
示例#5
0
 public CacheItem(FileReadStream stream)
 {
     this.stream    = stream;
     insertionPoint = DateTime.UtcNow;
 }
示例#6
0
 public CacheItem(FileReadStream stream)
 {
     Stream = stream;
 }