+static memcached_return_t item_counter(memcached_server_instance_st ,
+ const char *key, size_t key_length,
+ const char *value, size_t, // value_length,
+ void *context)
+{
+ if ((key_length == (sizeof("curr_items") -1)) and (strncmp("curr_items", key, (sizeof("curr_items") -1)) == 0))
+ {
+ uint64_t* counter= (uint64_t*)context;
+ unsigned long number_value= strtoul(value, (char **)NULL, 10);
+ if (number_value == ULONG_MAX)
+ {
+ return MEMCACHED_FAILURE;
+ }
+ *counter= *counter +number_value;
+ }
+
+ return MEMCACHED_SUCCESS;
+}
+
+#if 0