/// <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); }
public void TestWrite() { fileSystem.Write("foo", ToStream("foo")); Assert.AreEqual("foo", Read("foo")); }