using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using IStation.Untity;
|
|
namespace IStation.Service
|
{
|
/// <summary>
|
/// SignalType
|
/// »º´æ¸¨ÖúÀà
|
/// </summary>
|
internal class SignalTypeCacheHelper
|
{
|
private const string _contentKey = "SignalTypeListKey";
|
|
private static string GetCacheKey()
|
{
|
var contentKey = string.Format("{0}", _contentKey);
|
return CacheHelper.GetCacheKey(contentKey);
|
}
|
|
/// <summary>
|
/// ÉèÖûº´æ
|
/// </summary>
|
public static void Set(List<Model.SignalType> list, int Minites = 30, int RandomSeconds = 0)
|
{
|
var cacheKey = GetCacheKey();
|
MemoryCacheHelper.Set(cacheKey, list, Minites * 60 + RandomSeconds);
|
}
|
|
/// <summary>
|
/// »ñÈ¡»º´æ
|
/// </summary>
|
/// <returns></returns>
|
public static List<Model.SignalType> Get()
|
{
|
var cacheKey = GetCacheKey();
|
return MemoryCacheHelper.Get<List<Model.SignalType>>(cacheKey);
|
}
|
|
/// <summary>
|
/// »ñÈ¡ÉèÖûº´æ
|
/// </summary>
|
public static List<Model.SignalType> GetSet(Func<List<Model.SignalType>> func, int Minites = 30, int RandomSeconds = 0)
|
{
|
var cacheKey = GetCacheKey();
|
return MemoryCacheHelper.GetSet(cacheKey, func, Minites * 60 + RandomSeconds);
|
}
|
|
/// <summary>
|
/// ÒÆ³ý»º´æ
|
/// </summary>
|
public static void Remove()
|
{
|
var cacheKey = GetCacheKey();
|
MemoryCacheHelper.Remove(cacheKey);
|
}
|
|
|
}
|
}
|