public void Put(string key, DateTime timestamp, object instance) { using (var file = File.Create(Path.Combine(basePath, EscapeKey(key)))) { new BinaryFormatter().Serialize(file, new CachedData { Timestamp = timestamp, Value = instance }); file.Flush(); } }