using dodohold.core;


namespace molilian.core
{
    public class AccessTokenCore
    {
        public AccessTokenDTO Get(string domain, string ticket)
        {
            string key = $"token:{ticket}";
            
            return CenterHub.Redis.Get<AccessTokenDTO>(key);
        }

        public int Delete(string domain, string ticket)
        {

            string key = $"token:{ticket}";
            return Convert.ToInt32(CenterHub.Redis.Del(key));
        }

        internal bool Create(AccessTokenDTO token)
        {
            string key = $"token:{token.AccessTicket}";
            return CenterHub.Redis.Set(key, token, 86400 * 30);
        }


    }
}
