namespace Yw.Service
|
{
|
/// <summary>
|
/// DmaSite
|
/// »º´æ¸¨ÖúÀà
|
/// </summary>
|
internal class DmaSiteCacheHelper
|
{
|
private const string _contentKey = "DmaSiteList";
|
|
internal static string GetCacheKey()
|
{
|
return CacheHelper.GetCacheKey(_contentKey);
|
}
|
|
/// <summary>
|
/// ÉèÖûº´æ
|
/// </summary>
|
public static void Set(List<Model.DmaSite> 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.DmaSite> Get()
|
{
|
var cacheKey = GetCacheKey();
|
return MemoryCacheHelper.Get<List<Model.DmaSite>>(cacheKey);
|
}
|
|
/// <summary>
|
/// »ñÈ¡ÉèÖûº´æ
|
/// </summary>
|
public static List<Model.DmaSite> GetSet(Func<List<Model.DmaSite>> 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);
|
}
|
|
/// <summary>
|
/// ·¢²¼
|
/// </summary>
|
public static void Publish(string key)
|
{
|
var cacheKey = GetCacheKey();
|
MemoryCacheWipeRelationHelper.Set(key, cacheKey);
|
}
|
|
/// <summary>
|
/// ´¥·¢
|
/// </summary>
|
public static void Trigger()
|
{
|
var cacheKey = GetCacheKey();
|
MemoryCacheWipeRelationHelper.Trigger(cacheKey);
|
}
|
|
|
}
|
}
|