| 7 | } |
| 8 | |
| 9 | bool RedisSetModel::GetData( const std::string& key, RedisResult& results ) |
| 10 | { |
| 11 | bool retVal = false; |
| 12 | redisReply* reply = GetClient()->Command("SMEMBERS %s", key.c_str()); |
| 13 | if (!reply) return retVal; |
| 14 | results.NewColumn("Value"); |
| 15 | if (reply->type == REDIS_REPLY_ARRAY) |
| 16 | { |
| 17 | std::size_t i = 0; |
| 18 | redisReply* tmpReply ; |
| 19 | while (i < reply->elements) |
| 20 | { |
| 21 | tmpReply = reply->element[i]; |
| 22 | results.NewRow(); |
| 23 | string& myvalue = results.Value(results.RowSize()-1, 0); |
| 24 | myvalue.assign(tmpReply->str, tmpReply->len); |
| 25 | i++; |
| 26 | } |
| 27 | retVal = true; |
| 28 | |
| 29 | } |
| 30 | freeReplyObject(reply); |
| 31 | return retVal; |
| 32 | } |
| 33 | |
| 34 | bool RedisSetModel::UpdateData( const std::string& key, |
| 35 | const std::string& oldValue, |