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.
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using DB.Entity;
|
|
|
|
|
using NewLife.Caching;
|
|
|
|
|
|
|
|
|
|
namespace DB.Service
|
|
|
|
|
{
|
|
|
|
|
public class PointService
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Point> GetList()
|
|
|
|
|
{
|
|
|
|
|
using (var dbContext = DbFactory.GetContext)
|
|
|
|
|
{
|
|
|
|
|
return dbContext.Query<Point>().ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ICache _cache=Cache.Default;
|
|
|
|
|
private readonly string key = "PRINT";
|
|
|
|
|
public List<Point> GetCacheList()
|
|
|
|
|
{
|
|
|
|
|
if (_cache.ContainsKey(key))
|
|
|
|
|
{
|
|
|
|
|
return _cache.Get<List<Point>>(key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ls = GetList();
|
|
|
|
|
_cache.Set(key, ls, TimeSpan.FromHours(1));
|
|
|
|
|
return ls;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|