public static string new_token(string ticket) { if (string.IsNullOrEmpty(ticket)) { return(string.Empty); } AccessTokenList lst = get_token_list(ticket); string token = AccessTokenList.new_token(lst); if (RedisAPI.Enabled) { RedisAPI.set_value <AccessTokenList>(get_redis_token_key(ticket), lst); } return(token); }
public static AccessTokenList get_token_list(string ticket) { if (string.IsNullOrEmpty(ticket)) { return(null); } if (RedisAPI.Enabled) { AccessTokenList lst = RedisAPI.get_value <AccessTokenList>(get_redis_token_key(ticket)); return(lst == null ? new AccessTokenList() : lst); } else { if (!APITokens.ContainsKey(ticket)) { APITokens.Add(ticket, new AccessTokenList()); } return(APITokens[ticket]); } }