using System; using System.Collections.Generic; using System.IO; namespace AllocsFixes.FileCache { // Caching all files, useful for completely static folders only public class SimpleCache : AbstractCache { private Dictionary fileCache = new Dictionary (); public SimpleCache () { } public override byte[] GetFileContent (string filename) { try { lock (fileCache) { if (!fileCache.ContainsKey (filename)) { if (!File.Exists (filename)) { return null; } fileCache.Add (filename, File.ReadAllBytes (filename)); } return fileCache [filename]; } } catch (Exception e) { Log.Out ("Error in SimpleCache.GetFileContent: " + e); } return null; } } }