Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit 0259466

Browse files
author
hamidr
committed
Add sort command
1 parent cbc6a65 commit 0259466

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

includes/async_redis/redis_client.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ namespace async_redis
3838
void decr(const string& field, reply_cb_t reply);
3939
void ping(reply_cb_t reply);
4040
void publish(const string& channel, const string& msg, reply_cb_t&& reply);
41+
void sort(const string& hash_name, std::vector<string>&& fields, reply_cb_t&& reply);
4142

4243
//TODO: wtf?! doesnt make sense with multiple connections!
4344
// void select(uint catalog, reply_cb_t&& reply) {

src/redis_client.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ void redis_client::publish(const string& channel, const string& msg, reply_cb_t&
6969
send({"publish", channel, msg}, reply);
7070
}
7171

72+
void
73+
redis_client::sort(const string& hash_name, std::vector<string>&& fields, reply_cb_t&& reply)
74+
{
75+
std::string req;
76+
for (auto &field : fields)
77+
req += "get " + field + " ";
78+
79+
send({"sort " + hash_name + " by nosort", req}, reply);
80+
}
81+
82+
7283
void redis_client::commit_pipeline() {
7384
string buffer;
7485
std::swap(pipeline_buffer_, buffer);

0 commit comments

Comments
 (0)