[PATCH 1/2] Fix flush_all to accept both optional <time> and 'noreply'.

Tomash Brechko tomash.brechko at gmail.com
Fri Nov 9 15:05:44 UTC 2007


AFAIU this is the last command that had optional parameter.
---
 trunk/server/memcached.c |    6 +++---
 trunk/server/t/noreply.t |    3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/trunk/server/memcached.c b/trunk/server/memcached.c
index 6054f04..e432cd6 100644
--- a/trunk/server/memcached.c
+++ b/trunk/server/memcached.c
@@ -1661,15 +1661,15 @@ static void process_command(conn *c, char *command) {
         time_t exptime = 0;
         set_current_time();
 
-        if(ntokens == 2) {
+        set_noreply_maybe(c, tokens, ntokens);
+
+        if(ntokens == (c->noreply ? 3 : 2)) {
             settings.oldest_live = current_time - 1;
             item_flush_expired();
             out_string(c, "OK");
             return;
         }
 
-        set_noreply_maybe(c, tokens, ntokens);
-
         exptime = strtol(tokens[1].value, NULL, 10);
         if(errno == ERANGE) {
             out_string(c, "CLIENT_ERROR bad command line format");
diff --git a/trunk/server/t/noreply.t b/trunk/server/t/noreply.t
index b4dde02..c1457b0 100644
--- a/trunk/server/t/noreply.t
+++ b/trunk/server/t/noreply.t
@@ -11,8 +11,9 @@ my $server = new_memcached();
 my $sock = $server->sock;
 
 
-# Test that all update commands can take 'noreply' parameter.
+# Test that commands can take 'noreply' parameter.
 print $sock "flush_all noreply\r\n";
+print $sock "flush_all 0 noreply\r\n";
 
 print $sock "verbosity 0 noreply\r\n";
 
-- 
1.5.3.5.529.ge3d6d


More information about the memcached mailing list