using System; using NewLife.Caching; namespace Tool { public class CacheManager { public static void Act(string key,Action action) { ICache _cache=Cache.Default; if(_cache.ContainsKey(key)) return; try { _cache.Set(key, TimeSpan.FromSeconds(3000)); action(); } finally { _cache.Remove(key); } } } }