public ImageModel GetImages(string path) { var cachemanager = new CacheManager<ImageModel>("Images", 60 * 2); // 2 hours? cachemanager.Clear(); var cached = cachemanager.Grab(); if (cached == null) { var controller = path + "ImageModel.Json"; if (FileTools.SFileExists(controller)) cached = JsonHelper.DeserializeFromFile<ImageModel>(controller); else { cached = GetAllUnmangedImages(path); FileTools.SWriteFile(controller, JsonHelper.Serialize(cached)); } cachemanager.Insert(cached, CacheItemPriority.Normal); } return cached; }