using NewLife.Caching;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DB.Dto;
using Tool.Model;
namespace RfidWeb
{
///
/// 因为用户只有一个所有key是固定的
///
public static class UserManager
{
private static string key => CacheKeyManager.HmiUser;
private static ICache cache = Cache.Default;
public static void Add(UserDto dto)
{
cache.Set(key, dto, TimeSpan.FromDays(2));
}
public static UserDto GetUser()
{
return cache.Get(key);
}
public static bool IsExit()
{
return cache.ContainsKey(key);
}
public static void RestoreTime()
{
if (IsExit())
{
cache.SetExpire(key, TimeSpan.FromDays(2));
}
}
}
}