| 9 | } |
| 10 | |
| 11 | bool SSDBZSetModel::GetData( const std::string& key, RedisResult& results ) |
| 12 | { |
| 13 | results.NewColumn("Score"); |
| 14 | results.NewColumn("Value"); |
| 15 | std::vector<std::string> values ; |
| 16 | if (GetClient()->zrange(key, 0, 20000, &values).ok()) |
| 17 | { |
| 18 | for (std::size_t idx=0; idx<values.size();) |
| 19 | { |
| 20 | int64_t score = 0; |
| 21 | GetClient()->zget(key, values[idx], &score); |
| 22 | results.NewRow(); |
| 23 | std::string& scorestr = results.Value(results.RowSize()-1, 0); |
| 24 | std::string& value = results.Value(results.RowSize()-1, 1); |
| 25 | value = values[idx++]; |
| 26 | scorestr = values[idx++]; |
| 27 | } |
| 28 | } |
| 29 | else |
| 30 | { |
| 31 | return false; |
| 32 | } |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | bool SSDBZSetModel::UpdateData(const std::string& key, |
| 37 | const std::string& oldValue, |