You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
797 B
C#
35 lines
797 B
C#
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<AlarmData> GetList()
|
|
{
|
|
string key = CacheKeyManager.AramlDataList;
|
|
ICache cache = Cache.Default;
|
|
if (cache.ContainsKey(key))
|
|
{
|
|
return cache.Get<List<AlarmData>>(key);
|
|
}
|
|
using (var dbContext = DbFactory.GetContext)
|
|
{
|
|
var entity= dbContext.Query<AlarmData>()
|
|
.ToList();
|
|
|
|
cache.Set(key, entity, TimeSpan.FromMinutes(5));
|
|
return entity;
|
|
}
|
|
}
|
|
}
|
|
}
|