summaryrefslogtreecommitdiff
path: root/memcached.c
diff options
context:
space:
mode:
Diffstat (limited to 'memcached.c')
-rw-r--r--memcached.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/memcached.c b/memcached.c
index 95a0124..a578b10 100644
--- a/memcached.c
+++ b/memcached.c
@@ -3069,6 +3069,9 @@ enum delta_result_type do_add_delta(conn *c, const char *key, const size_t nkey,
memcpy(ITEM_data(new_it), buf, res);
memcpy(ITEM_data(new_it) + res, "\r\n", 2);
item_replace(it, new_it);
+ // Overwrite the older item's CAS with our new CAS since we're
+ // returning the CAS of the old item below.
+ ITEM_set_cas(it, (settings.use_cas) ? ITEM_get_cas(new_it) : 0);
do_item_remove(new_it); /* release our reference */
} else { /* replace in-place */
/* When changing the value without replacing the item, we