Refactor: memcached_mget_execute -> memcached_mget_execute_by_key
authorTrond Norbye <trond.norbye@sun.com>
Wed, 14 Oct 2009 18:50:03 +0000 (20:50 +0200)
committerTrond Norbye <trond.norbye@sun.com>
Wed, 14 Oct 2009 18:50:03 +0000 (20:50 +0200)
docs/Makefile.am
docs/memcached_get.pod
libmemcached/memcached_get.c
libmemcached/memcached_get.h
tests/function.c

index ec5512761fdb45bea8ecc860c4a5db486f41a9ab..9a4ee49ac8cdc28ed71a234833acc6517603e586 100644 (file)
@@ -75,6 +75,7 @@ man_MANS = libmemcached.3\
        memcached_mget.3\
        memcached_mget_by_key.3\
         memcached_mget_execute.3 \
+        memcached_mget_execute_by_key.3 \
        memcached_prepend.3\
        memcached_prepend_by_key.3\
        memcached_replace.3\
@@ -216,6 +217,9 @@ memcached_mget_by_key.3: memcached_get.pod
 memcached_mget_execute.3: memcached_get.pod
        ${POD2MAN} -c "libmemcached" -r "" -s 3 ${top_srcdir}/docs/memcached_get.pod > memcached_mget_execute.3
 
+memcached_mget_execute_by_key.3: memcached_get.pod
+       ${POD2MAN} -c "libmemcached" -r "" -s 3 ${top_srcdir}/docs/memcached_get.pod > memcached_mget_execute_by_key.3
+
 memcached_fetch.3: memcached_get.pod
        ${POD2MAN} -c "libmemcached" -r "" -s 3 ${top_srcdir}/docs/memcached_get.pod > memcached_fetch.3
 
index 5dde1edcbc0ab8cf66e5e06d6343a280c0a37606..db2c9b5ae9d8295b665bf1c0fd18758366d42b9a 100644 (file)
@@ -1,6 +1,7 @@
 =head1 NAME
 
-memcached_get, memcached_mget, memcached_fetch - Get a value
+memcached_get, memcached_mget, memcached_fetch, memcached_mget_execute,
+memcached_mget_execute_by_key - Get a value
 
 =head1 LIBRARY
 
@@ -54,10 +55,8 @@ C Client Library for memcached (libmemcached, -lmemcached)
                           unsigned int number_of_callbacks);
 
 
-  memcached_return 
+  memcached_return
   memcached_mget_execute(memcached_st *ptr,
-                         const char *master_key,
-                         size_t master_key_length,
                          const char * const *keys,
                          const size_t *key_length,
                          size_t number_of_keys,
@@ -65,6 +64,17 @@ C Client Library for memcached (libmemcached, -lmemcached)
                          void *context,
                          unsigned int number_of_callbacks);
 
+  memcached_return 
+  memcached_mget_execute_by_key(memcached_st *ptr,
+                                const char *master_key,
+                                size_t master_key_length,
+                                const char * const *keys,
+                                const size_t *key_length,
+                                size_t number_of_keys,
+                                memcached_execute_function *callback,
+                                void *context,
+                                unsigned int number_of_callbacks);
+
 
 =head1 DESCRIPTION
 
@@ -115,14 +125,15 @@ you supply the calling function. Currently only one value is being passed
 to each function call. In the future there will be an option to allow this
 to be an array.
 
-memcached_mget_execute() is similar to memcached_mget(), but it may trigger
-the supplied callbacks with result sets while sending out the queries. If
-you try to perform a really large multiget with memcached_mget() you may
-encounter a deadlock in the OS kernel (we fail to write data to the socket
-because the input buffer is full). memcached_mget_execute() solves this
-problem by processing some of the results before continuing sending out
-requests. Please note that this function is only available in the binary
-protocol.
+memcached_mget_execute() and memcached_mget_execute_by_key() is
+similar to memcached_mget(), but it may trigger the supplied callbacks
+with result sets while sending out the queries. If you try to perform
+a really large multiget with memcached_mget() you may encounter a
+deadlock in the OS kernel (we fail to write data to the socket because
+the input buffer is full). memcached_mget_execute() solves this
+problem by processing some of the results before continuing sending
+out requests. Please note that this function is only available in the
+binary protocol.
 
 memcached_get_by_key() and memcached_mget_by_key() behave in a similar nature
 as memcached_get() and memcached_mget(). The difference is that they take
index cf0d210d27c2444842aac08f237bc81780d6a268..3436186f24a4803a32bf107e9c0f773489f8f53f 100644 (file)
@@ -279,14 +279,27 @@ memcached_return memcached_mget_by_key(memcached_st *ptr,
 }
 
 memcached_return memcached_mget_execute(memcached_st *ptr,
-                                        const char *master_key,
-                                        size_t master_key_length,
                                         const char * const *keys,
                                         const size_t *key_length,
                                         size_t number_of_keys,
                                         memcached_execute_function *callback,
                                         void *context,
                                         unsigned int number_of_callbacks)
+{
+  return memcached_mget_execute_by_key(ptr, NULL, 0, keys, key_length,
+                                       number_of_keys, callback,
+                                       context, number_of_callbacks);
+}
+
+memcached_return memcached_mget_execute_by_key(memcached_st *ptr,
+                                               const char *master_key,
+                                               size_t master_key_length,
+                                               const char * const *keys,
+                                               const size_t *key_length,
+                                               size_t number_of_keys,
+                                               memcached_execute_function *callback,
+                                               void *context,
+                                               unsigned int number_of_callbacks)
 {
   if ((ptr->flags & MEM_BINARY_PROTOCOL) == 0)
     return MEMCACHED_NOT_SUPPORTED;
index 11dd7fee82884923b33224375828a3a83ee3cc62..bf3aeb5333728459bf243ee4af50c0daa13004bb 100644 (file)
@@ -56,8 +56,6 @@ memcached_result_st *memcached_fetch_result(memcached_st *ptr,
 
 LIBMEMCACHED_API
 memcached_return memcached_mget_execute(memcached_st *ptr,
-                                        const char *master_key,
-                                        size_t master_key_length,
                                         const char * const *keys,
                                         const size_t *key_length,
                                         size_t number_of_keys,
@@ -65,6 +63,17 @@ memcached_return memcached_mget_execute(memcached_st *ptr,
                                         void *context,
                                         unsigned int number_of_callbacks);
 
+LIBMEMCACHED_API
+memcached_return memcached_mget_execute_by_key(memcached_st *ptr,
+                                               const char *master_key,
+                                               size_t master_key_length,
+                                               const char * const *keys,
+                                               const size_t *key_length,
+                                               size_t number_of_keys,
+                                               memcached_execute_function *callback,
+                                               void *context,
+                                               unsigned int number_of_callbacks);
+
 #ifdef __cplusplus
 }
 #endif
index c53ac70087f46956014f045cb8659d099e850221..2bc0192b3f0cf39f510eefcb729ae4b2852e2ce2 100644 (file)
@@ -1484,8 +1484,7 @@ static test_return_t mget_execute(memcached_st *memc)
   /* Try to get all of them with a large multiget */
   unsigned int counter= 0;
   memcached_execute_function callbacks[1]= { [0]= &callback_counter };
-  rc= memcached_mget_execute(memc, NULL, 0,
-                             (const char**)keys, key_length,
+  rc= memcached_mget_execute(memc, (const char**)keys, key_length,
                              (size_t)max_keys, callbacks, &counter, 1);
 
   if (binary)