AccessTokenCore.cs 654 B

1234567891011121314151617181920212223242526272829
  1. using dodohold.core;
  2. namespace molilian.core
  3. {
  4. public class AccessTokenCore
  5. {
  6. public AccessTokenDTO Get(string domain, string ticket)
  7. {
  8. string key = $"token:{ticket}";
  9. return RedisHelper.Get<AccessTokenDTO>(key);
  10. }
  11. public int Delete(string domain, string ticket)
  12. {
  13. string key = $"token:{ticket}";
  14. return Convert.ToInt32(RedisHelper.Del(key));
  15. }
  16. internal bool Create(AccessTokenDTO token)
  17. {
  18. string key = $"token:{token.AccessTicket}";
  19. return RedisHelper.Set(key, token, 86400 * 30);
  20. }
  21. }
  22. }