Inheritance: System.IO.FileStream
Ejemplo n.º 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();
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 3
0
 public CacheItem(FileReadStream stream)
 {
     this.stream = stream;
     insertionPoint = DateTime.UtcNow;
 }
Ejemplo n.º 4
0
 public CacheItem(FileReadStream stream)
 {
     Stream = stream;
 }
Ejemplo n.º 5
0
 public CacheItem(FileReadStream stream)
 {
     this.stream    = stream;
     insertionPoint = DateTime.UtcNow;
 }
Ejemplo n.º 6
0
 public CacheItem(FileReadStream stream)
 {
     Stream = stream;
 }