AccessTokenCore.cs 709 B

123456789101112131415161718192021222324252627282930
  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 CenterHub.Redis.Get<AccessTokenDTO>(key);
  10. }
  11. public int Delete(string domain, string ticket)
  12. {
  13. string key = $"token:{ticket}";
  14. return Convert.ToInt32(CenterHub.Redis.Del(key));
  15. }
  16. internal bool Create(AccessTokenDTO token)
  17. {
  18. string key = $"token:{token.AccessTicket}";
  19. return CenterHub.Redis.Set(key, token, 86400 * 30);
  20. }
  21. }
  22. }