public string GetTokenByUserID(string ID) { try { var Redis = new RadisServices <ConnetedClientToken>(this._fact); string AccessToken = Redis.GetHashData("Tokens:" + ID.ToString(), "Token"); return(AccessToken); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); //throw ex; return(""); } }
public Task OnTokenChange(string Token) { try { var Redis = new RadisServices <ConnetedClientToken>(this._fact); string AccessToken = Redis.GetHashData(Token, "accessToken"); ConnetedClientToken ClientToken = new ConnetedClientToken(); ClientToken = Redis.GetData("Users:" + Context.ConnectionId); Redis.DeleteTag("Users:" + Context.ConnectionId, ClientToken.Token); Redis.SaveToHash("Users:" + Context.ConnectionId, new ConnetedClientToken { Token = AccessToken }, AccessToken); return(Task.FromResult(0)); } catch (Exception ex) { _logger.LogError(ex, "An unexpected exception occured,\nMethodName:" + System.Reflection.MethodBase.GetCurrentMethod().Name + "\nClassname=" + this.GetType().Name, LogLevel.Error); return(Task.FromResult(0)); } }