public void Add(string name, object obj, DateTime expireDate) { var item = new SimpleFileCacheItem <object> { Content = obj, ExpireDate = expireDate }; var path = GetCachePath(name); SerializeToFile(path, item); }
/// <summary> /// Writes the given object instance to a text file. /// </summary> /// <param name="path"></param> /// <param name="item"></param> protected void SerializeToFile(string path, SimpleFileCacheItem <object> item) { var json = JsonConvert.SerializeObject(item); File.WriteAllText(path, json); }