summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2011-10-04 01:19:10 -0700
committerdormando <dormando@rydia.net>2011-10-04 01:22:29 -0700
commitc9055e8423b2ccbe7bf18fc1224a069574886fd0 (patch)
tree2ea81ecb04d8a264f17ea0132cc153c19574788c
parentb7ba2969db0257e9464cf63f0fa36e310ca77214 (diff)
downloadmemcached-c9055e8423b2ccbe7bf18fc1224a069574886fd0.tar.gz
Add missing LRU bumps to binary get and others
An audit turned up that the LRU bump to move just accessed items to the front was missing from the binary get command. It was also missing from incr/decr and the new touch commands. If someone was using the binary protocol exclusively, memcached would be acting as a FIFO for stored items.
-rw-r--r--memcached.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/memcached.c b/memcached.c
index c7df0bd..f8c16f1 100644
--- a/memcached.c
+++ b/memcached.c
@@ -1210,6 +1210,7 @@ static void process_bin_touch(conn *c) {
uint16_t keylen = 0;
uint32_t bodylen = sizeof(rsp->message.body) + (it->nbytes - 2);
+ item_update(it);
pthread_mutex_lock(&c->thread->stats.mutex);
c->thread->stats.touch_cmds++;
c->thread->stats.slab_stats[it->slabs_clsid].touch_hits++;
@@ -1297,6 +1298,7 @@ static void process_bin_get(conn *c) {
uint16_t keylen = 0;
uint32_t bodylen = sizeof(rsp->message.body) + (it->nbytes - 2);
+ item_update(it);
pthread_mutex_lock(&c->thread->stats.mutex);
c->thread->stats.get_cmds++;
c->thread->stats.slab_stats[it->slabs_clsid].get_hits++;
@@ -2944,6 +2946,7 @@ static void process_touch_command(conn *c, token_t *tokens, const size_t ntokens
it = item_touch(key, nkey, realtime(exptime_int));
if (it) {
+ item_update(it);
pthread_mutex_lock(&c->thread->stats.mutex);
c->thread->stats.touch_cmds++;
c->thread->stats.slab_stats[it->slabs_clsid].touch_hits++;
@@ -3089,6 +3092,7 @@ enum delta_result_type do_add_delta(conn *c, const char *key, const size_t nkey,
memcpy(ITEM_data(it), buf, res);
memset(ITEM_data(it) + res, ' ', it->nbytes - res - 2);
+ do_item_update(it);
}
if (cas) {