public ApiResult HashIn(string key) { HashSet <string> setField = new HashSet <string>(); List <Action <IRedisClient> > actions = new List <Action <IRedisClient> >(); UserModel entity1 = new Models.UserModel(); //if (setField == null || setField.Contains("UserName")) actions.Add(redis => redis.SetEntryInHash(key, $"{0}:", entity1.UserName ?? "")); //if (setField == null || setField.Contains("NickName")) actions.Add(redis => redis.SetEntryInHash(key, $"{1}:", entity1.NickName ?? "")); //if (setField == null || setField.Contains("Sex")) actions.Add(redis => redis.SetEntryInHash(key, $"{2}:", (entity1.Sex ? 1 : 0).ToString())); //if (setField == null || setField.Contains("HeadUrl")) actions.Add(redis => redis.SetEntryInHash(key, $"{3}:", entity1.HeadUrl ?? "")); //if (setField == null || setField.Contains("PhoneNo")) actions.Add(redis => redis.SetEntryInHash(key, $"{4}:", entity1.PhoneNo.ToString())); //if (setField == null || setField.Contains("Address")) actions.Add(redis => redis.SetEntryInHash(key, $"{5}:", entity1.Address ?? "")); // 开始执行 RedisBase.DoPipeline(actions); return(ApiResult.ReturnWebResult(true, "", entity1)); }