示例#1
0
        /// <summary>
        /// Copy a file out of the cache to local disk.
        /// </summary>
        /// <param name="cache">The cache system instance.</param>
        /// <param name="file">The cache file name.</param>
        /// <param name="target">Absolute path to the local disk.</param>
        /// <returns>True if the copy successful.</returns>
        public static bool CopyTo(this ICache cache, string file, string target)
        {
            if (!cache.Enable)
            {
                return(false);
            }

            var local = new FileSystemLocal();

            using (var stream = cache.Read(file))
            {
                local.Write(target, stream);
            }

            return(true);
        }
示例#2
0
 public void TestWrite()
 {
     fileSystem.Write("foo", ToStream("foo"));
     Assert.AreEqual("foo", Read("foo"));
 }