char *key, size_t key_length,
time_t expiration);
+memcached_return memcached_mdelete(memcached_st *ptr,
+ char **key, size_t *key_length,
+ unsigned int number_of_keys,
+ time_t expiration);
+
+memcached_return memcached_mdelete_by_key(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char **key, size_t *key_length,
+ unsigned int number_of_keys,
+ time_t expiration);
+
/* Result Struct */
void memcached_result_free(memcached_result_st *result);
memcached_result_st *memcached_result_create(memcached_st *ptr,
LIBMEMCACHED_MEMCACHED_DELETE_END();
return rc;
}
+
+memcached_return memcached_mdelete(memcached_st *ptr,
+ char **key, size_t *key_length,
+ unsigned int number_of_keys,
+ time_t expiration)
+{
+ return memcached_mdelete_by_key(ptr, NULL, 0,
+ key, key_length,
+ number_of_keys, expiration);
+
+}
+
+memcached_return memcached_mdelete_by_key(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char **key, size_t *key_length,
+ unsigned int number_of_keys,
+ time_t expiration)
+{
+ size_t send_length;
+ memcached_return rc= MEMCACHED_SUCCESS;
+ char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
+ unsigned int master_server_key= 0;
+ unsigned int x;
+
+ LIBMEMCACHED_MEMCACHED_DELETE_START();
+
+ if (ptr->hosts == NULL || ptr->number_of_hosts == 0)
+ return MEMCACHED_NO_SERVERS;
+
+ if (master_key && master_key_length)
+ master_server_key= memcached_generate_hash(ptr, master_key, master_key_length);
+
+ for (x= 0; x < number_of_keys; x++)
+ {
+ unsigned int server_key;
+
+ if (master_key && master_key_length)
+ server_key= master_server_key;
+ else
+ server_key= memcached_generate_hash(ptr, key[x], key_length[x]);
+
+ if (expiration)
+ send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
+ "delete %.*s %llu\r\n", (int)(key_length[x]), key[x],
+ (unsigned long long)expiration);
+ else
+ send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
+ "delete %.*s\r\n", (int)(key_length[x]), key[x]);
+
+ (void)memcached_do(ptr, server_key, buffer, send_length, 0);
+ }
+
+ for (x= 0; x < ptr->number_of_hosts; x++)
+ {
+ if (memcached_server_response_count(ptr, x))
+ {
+ /* We need to do something about non-connnected hosts in the future */
+ if ((memcached_io_write(ptr, x, NULL, 0, 1)) == -1)
+ {
+ rc= MEMCACHED_SOME_ERRORS;
+ }
+ }
+ }
+
+ LIBMEMCACHED_MEMCACHED_DELETE_END();
+ return rc;
+}
return 0;
}
+uint8_t delete_generate(memcached_st *memc)
+{
+ unsigned int x;
+
+ for (x= 0; x < GLOBAL_COUNT; x++)
+ {
+ (void)memcached_delete(memc, global_keys[x], global_keys_length[x], (time_t)0);
+ }
+
+ return 0;
+}
+
+uint8_t mdelete_generate(memcached_st *memc)
+{
+ memcached_return rc;
+
+ rc= memcached_mdelete(memc, global_keys, global_keys_length, GLOBAL_COUNT, 0);
+
+ return 0;
+}
+
+
uint8_t free_data(memcached_st *memc)
{
pairs_free(global_pairs);
{"get_read", 0, get_read },
{"mget_read", 0, mget_read },
{"mget_read_result", 0, mget_read_result },
+ {"mdelete_generate", 0, mdelete_generate },
+ {"delete_generate", 0, delete_generate },
{"cleanup", 0, cleanup_pairs },
{0, 0, 0}
};