public HttpResponseMessage KeyExists(BaseModel model) { string Result = string.Empty; try { string ConnectString = StackExchangeRedis.GetConnectString(model.RedisIP, model.RedisPort, model.RedisPassword); Result = StackExchangeRedis.KeyExists(ConnectString, model.RedisKey).ToString(); } catch (Exception ex) { LogHelper.Error(ex.ToString()); } HttpResponseMessage Respend = new HttpResponseMessage { Content = new StringContent(Result, Encoding.GetEncoding("UTF-8"), "application/json") }; return(Respend); }
public HttpResponseMessage StringSet(BaseModel model) { string Result = string.Empty; try { string ConnectString = StackExchangeRedis.GetConnectString(model.RedisIP, model.RedisPort, model.RedisPassword); Result = StackExchangeRedis.StringSet(ConnectString, model.RedisKey, model.RedisValue, new TimeSpan(0, 0, Convert.ToInt32(model.LifeCycle))).ToString(); } catch (Exception ex) { LogHelper.Error(ex.ToString()); } HttpResponseMessage Respend = new HttpResponseMessage { Content = new StringContent(Result, Encoding.GetEncoding("UTF-8")) }; return(Respend); }