++0.38
++
++ * memcached_purge() now calls any callbacks registered during get
++ execution.
++
+0.37 Mon Jan 11 16:29:57 PST 2010
+ * Fixed build for libhashkit.
+ * Fixed install path regression.
+ * Modified RPM to strict check install.
+ * Added documentation for memcached_server_cursor();
+ * Added memcached_servers_reset().
+ * Modified memcached_st to remove dead cursor_server member.
+
+0.36 Wed Jan 6 18:23:50 PST 2010
+ * Merged in new memslap utility.
+ * All of constants.h has been updated to match style (all old identifiers
+ continue to work).
+ * Added first pass for libhashkit.
+ * Updated test Framework/extended tests.
+ * Random read support during replication added.
+ * Modified use_sort so that the option can be applied to any distribution type.
+ * We removed the MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE added in 0.35. Instead use
+ memcached_behavior_set_distribution().
+
0.35 Mon Nov 9 11:18:33 PST 2009
* Added support for by_key operations for inc/dec methods.
* Added mget test to memslap.
--- /dev/null
+#include "common.h"
+
+memcached_return_t memcached_purge(memcached_server_instance_st *ptr)
+{
+ uint32_t x;
+ memcached_return_t ret= MEMCACHED_SUCCESS;
+
+ if (ptr->root->options.is_purging || /* already purging */
+ (memcached_server_response_count(ptr) < ptr->root->io_msg_watermark &&
+ ptr->io_bytes_sent < ptr->root->io_bytes_watermark) ||
+ (ptr->io_bytes_sent >= ptr->root->io_bytes_watermark &&
+ memcached_server_response_count(ptr) < 2))
+ {
+ return MEMCACHED_SUCCESS;
+ }
+
+ /* memcached_io_write and memcached_response may call memcached_purge
+ so we need to be able stop any recursion.. */
+ ptr->root->options.is_purging= true;
+
+ WATCHPOINT_ASSERT(ptr->fd != -1);
+ /* Force a flush of the buffer to ensure that we don't have the n-1 pending
+ requests buffered up.. */
+ if (memcached_io_write(ptr, NULL, 0, 1) == -1)
+ {
+ ptr->root->options.is_purging= true;
+ return MEMCACHED_WRITE_FAILURE;
+ }
+ WATCHPOINT_ASSERT(ptr->fd != -1);
+
+ uint32_t no_msg= memcached_server_response_count(ptr) - 1;
+ if (no_msg > 0)
+ {
+ memcached_result_st result;
+ memcached_result_st *result_ptr;
+ char buffer[SMALL_STRING_LEN];
+
+ /*
+ * We need to increase the timeout, because we might be waiting for
+ * data to be sent from the server (the commands was in the output buffer
+ * and just flushed
+ */
+ int32_t timeo= ptr->root->poll_timeout;
+ ptr->root->poll_timeout= 2000;
+
+ result_ptr= memcached_result_create(ptr->root, &result);
+ WATCHPOINT_ASSERT(result_ptr);
+
+ for (x= 0; x < no_msg; x++)
+ {
+ memcached_result_reset(result_ptr);
+ memcached_return_t rc= memcached_read_one_response(ptr, buffer,
+ sizeof (buffer),
+ result_ptr);
+ /*
+ * Purge doesn't care for what kind of command results that is received.
+ * The only kind of errors I care about if is I'm out of sync with the
+ * protocol or have problems reading data from the network..
+ */
+ if (rc== MEMCACHED_PROTOCOL_ERROR || rc == MEMCACHED_UNKNOWN_READ_FAILURE)
+ {
+ WATCHPOINT_ERROR(rc);
+ ret = rc;
+ memcached_io_reset(ptr);
+ }
++
++ if (ptr->root->callbacks != NULL)
++ {
++ memcached_callback_st cb = *ptr->root->callbacks;
++ if (rc == MEMCACHED_SUCCESS)
++ {
++ for (uint32_t y= 0; y < cb.number_of_callback; y++)
++ {
++ rc = (*cb.callback[y])(ptr->root, result_ptr, cb.context);
++ if (rc != MEMCACHED_SUCCESS)
++ break;
++ }
++ }
++ }
+ }
+
+ memcached_result_free(result_ptr);
+ ptr->root->poll_timeout= timeo;
+ }
+ ptr->root->options.is_purging= false;
+
+ return ret;
+}