예제 #1
0
        /// <summary>
        /// Reads the file into memory
        /// </summary>
        /// <param name="physicalPath"></param>
        MemCachedFile(string physicalPath)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();

            this.path = physicalPath;
            using (System.IO.FileStream fs = new FileStream(physicalPath, FileMode.Open, FileAccess.Read))
            {
                this.data = fs.CopyToBytes();
            }

            sw.Stop();
            if (HttpContext.Current != null)
            {
                HttpContext.Current.Trace.Write("MemCachedFile loaded file into memory in " + sw.ElapsedMilliseconds + "ms");
            }
        }