using DB.Entity; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NewLife.Caching; using Tool.Model; namespace DB.Service { public class AlarmDataService { public List GetList() { string key = CacheKeyManager.AramlDataList; ICache cache = Cache.Default; if (cache.ContainsKey(key)) { return cache.Get>(key); } using (var dbContext = DbFactory.GetContext) { var entity= dbContext.Query() .ToList(); cache.Set(key, entity, TimeSpan.FromMinutes(5)); return entity; } } } }