1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
--- memcached.c.1.1.12 2005-04-05 02:10:26.000000000 +0200
+++ memcached.c 2005-07-06 20:01:02.000000000 +0200
@@ -619,8 +619,8 @@
if (it && (it->it_flags & ITEM_DELETED)) {
it = 0;
}
- if (settings.oldest_live && it &&
- it->time <= settings.oldest_live) {
+ if (settings.oldest_live && settings.oldest_live <= now &&
+ it && it->time <= settings.oldest_live) {
item_unlink(it);
it = 0;
}
@@ -707,8 +707,23 @@
return;
}
- if (strcmp(command, "flush_all") == 0) {
- settings.oldest_live = time(0);
+ if (strncmp(command, "flush_all", 9) == 0) {
+ time_t exptime = 0;
+ int res;
+
+ if (strcmp(command, "flush_all") == 0) {
+ settings.oldest_live = time(0);
+ out_string(c, "OK");
+ return;
+ }
+
+ res = sscanf(command, "%*s %ld", &exptime);
+ if (res != 1) {
+ out_string(c, "ERROR");
+ return;
+ }
+
+ settings.oldest_live = realtime(exptime);
out_string(c, "OK");
return;
}
--- doc/protocol.txt.1.1.12 2004-04-26 23:26:48.000000000 +0200
+++ doc/protocol.txt 2005-07-06 20:09:24.000000000 +0200
@@ -359,16 +359,17 @@
Other commands
--------------
-"flush_all" is a command with no arguments. It always succeeds,
-and the server sends "OK\r\n" in response. Its effect is to immediately
-invalidate all existing items: none of them will be returned in
-response to a retrieval command (unless it's stored again under the
-same key *after* flush_all has been executed). flush_all doesn't
+"flush_all" is a command with an optional numeric argument. It always
+succeeds, and the server sends "OK\r\n" in response. Its effect is to
+invalidate all existing items immediately (by default) or after the
+expiration specified. After invalidation none of the items will be returned
+in response to a retrieval command (unless it's stored again under the
+same key *after* flush_all has invalidated the items). flush_all doesn't
actually free all the memory taken up by existing items; that will
happen gradually as new items are stored. The most precise definition
of what flush_all does is the following: it causes all items whose
-update time is earlier than the time at which flush_all was executed
-to be ignored for retrieval purposes.
+update time is earlier than the time at which flush_all was set to be
+executed to be ignored for retrieval purposes.
"version" is a command with no arguments:
|