--------
-:manpage:`memcached(1)` :manpage:`libmemcached_examples(3)` :manpage:`libmemcached(1)` :manpage:`memcat(1)` :manpage:`memcp(1)` :manpage:`memflush(1)` :manpage:`memrm(1)` :manpage:`memslap(1)` :manpage:`memstat(1)` :manpage:`memcached_fetch(3)` :manpage:`memcached_replace(3)` :manpage:`memcached_server_list_free(3)` :manpage:`libmemcached_examples(3)` :manpage:`memcached_clone(3)` :manpage:`memcached_free(3)`
-:manpage:`memcached_server_add(3)` :manpage:`memcached_server_push(3)` :manpage:`memcached_add(3)` :manpage:`memcached_get(3)` :manpage:`memcached_server_count(3)` :manpage:`memcached_servers_parse(3)` :manpage:`memcached_create(3)` :manpage:`memcached_increment(3)` :manpage:`memcached_server_list(3)` :manpage:`memcached_set(3)`
-:manpage:`memcached_decrement(3)` :manpage:`memcached_mget(3)` :manpage:`memcached_server_list_append(3)` :manpage:`memcached_strerror(3)` :manpage:`memcached_delete(3)` :manpage:`memcached_quit(3)` :manpage:`memcached_server_list_count(3)` :manpage:`memcached_verbosity(3)` :manpage:`memcached_server_add_unix_socket(3)` :manpage:`memcached_result_create(3)` :manpage:`memcached_result_free(3)`
-:manpage:`memcached_result_key_value(3)` :manpage:`memcached_result_key_length(3)` :manpage:`memcached_result_value(3)` :manpage:`memcached_result_length(3)` :manpage:`memcached_result_flags(3)`
-:manpage:`memcached_result_cas(3)` :manpage:`memcached_result_st(3)` :manpage:`memcached_append(3)` :manpage:`memcached_prepend(3)` :manpage:`memcached_fetch_result(3)`
-:manpage:`memerror(1)` :manpage:`memcached_get_by_key(3)` :manpage:`memcached_mget_by_key(3)` :manpage:`memcached_delete_by_key(3)`
-:manpage:`memcached_fetch_execute(3)` :manpage:`memcached_callback_get(3)` :manpage:`memcached_callback_set(3)` :manpage:`memcached_version(3)`
-:manpage:`memcached_lib_version(3)` :manpage:`memcached_result_set_value(3)` :manpage:`memcached_dump(3)` :manpage:`memdump(1)`
-:manpage:`memcached_set_memory_allocators(3)` :manpage:`memcached_get_memory_allocators(3)` :manpage:`memcached_get_user_data(3)` :manpage:`memcached_set_user_data(3)`
+:manpage:`memcached(1)` :manpage:`libmemcached_examples(3)`
+:manpage:`libmemcached(1)` :manpage:`memcat(1)` :manpage:`memcp(1)`
+:manpage:`memflush(1)` :manpage:`memrm(1)` :manpage:`memslap(1)`
+:manpage:`memstat(1)` :manpage:`memcached_fetch(3)`
+:manpage:`memcached_replace(3)` :manpage:`memcached_server_list_free(3)`
+:manpage:`libmemcached_examples(3)` :manpage:`memcached_clone(3)`
+:manpage:`memcached_free(3)` :manpage:`memcached_server_add(3)`
+:manpage:`memcached_server_push(3)` :manpage:`memcached_add(3)`
+:manpage:`memcached_get(3)` :manpage:`memcached_server_count(3)`
+:manpage:`memcached_create(3)` :manpage:`memcached_increment(3)`
+:manpage:`memcached_server_list(3)` :manpage:`memcached_set(3)`
+:manpage:`memcached_decrement(3)` :manpage:`memcached_mget(3)`
+:manpage:`memcached_server_list_append(3)` :manpage:`memcached_strerror(3)`
+:manpage:`memcached_delete(3)` :manpage:`memcached_quit(3)`
+:manpage:`memcached_server_list_count(3)` :manpage:`memcached_verbosity(3)`
+:manpage:`memcached_server_add_unix_socket(3)`
+:manpage:`memcached_result_create(3)` :manpage:`memcached_result_free(3)`
+:manpage:`memcached_result_key_value(3)`
+:manpage:`memcached_result_key_length(3)`
+:manpage:`memcached_result_value(3)` :manpage:`memcached_result_length(3)`
+:manpage:`memcached_result_flags(3)` :manpage:`memcached_result_cas(3)`
+:manpage:`memcached_result_st(3)` :manpage:`memcached_append(3)`
+:manpage:`memcached_prepend(3)` :manpage:`memcached_fetch_result(3)`
+:manpage:`memerror(1)` :manpage:`memcached_get_by_key(3)`
+:manpage:`memcached_mget_by_key(3)` :manpage:`memcached_delete_by_key(3)`
+:manpage:`memcached_fetch_execute(3)` :manpage:`memcached_callback_get(3)`
+:manpage:`memcached_callback_set(3)` :manpage:`memcached_version(3)`
+:manpage:`memcached_lib_version(3)` :manpage:`memcached_result_set_value(3)`
+:manpage:`memcached_dump(3)` :manpage:`memdump(1)`
+:manpage:`memcached_set_memory_allocators(3)`
+:manpage:`memcached_get_memory_allocators(3)`
+:manpage:`memcached_get_user_data(3)` :manpage:`memcached_set_user_data(3)`
=========================
-Manage server list
-
-
-*******
-LIBRARY
-*******
-
-
-C Client Library for memcached (libmemcached, -lmemcached)
-
--------
SYNOPSIS
-.. code-block:: perl
-
- #include <libmemcached/memcached.h>
+#include <libmemcached/memcached.h>
- const memcached_server_instance_st
- memcached_server_list (memcached_st *ptr);
-
- void memcached_server_list_free (memcached_server_list_st list);
-
- memcached_server_list_st
- memcached_server_list_append (memcached_server_list_st list,
- const char *hostname,
- unsigned int port,
- memcached_return_t *error);
+.. c:function:: const memcached_server_instance_st memcached_server_list (memcached_st *ptr);
+
+.. c:function:: void memcached_server_list_free (memcached_server_list_st list);
- uint32_t memcached_server_list_count (memcached_server_list_st list);
+.. c:function:: memcached_server_list_st memcached_server_list_append (memcached_server_list_st list, const char *hostname, unsigned int port, memcached_return_t *error);
- memcached_server_list_st memcached_servers_parse (const char *server_strings);
+.. c:function:: uint32_t memcached_server_list_count (memcached_server_list_st list);
- const char *memcached_server_error (memcached_server_instance_st instance);
+.. c:function:: const char *memcached_server_error (memcached_server_instance_st instance);
- DEPRECATED
- void memcached_server_error_reset (memcached_server_instance_st list);
+.. c:function:: void memcached_server_error_reset (memcached_server_instance_st list); DEPRECATED
+
+Compile and link with -lmemcached
-----------
appropriate error. If the value of port is zero, it is set to the default
port of a memcached server.
-memcached_servers_parse() takes a string, the type that is used for the
-command line applications, and parse it to an array of memcached_server_st.
-The example is "localhost, foo:555, foo, bar". All hosts except foo:555 will
-be set to the default port, while that host will have a port of 555.
+DEPRECATED memcached_servers_parse(), please see :manpage:`memcached(3)`
memcached_server_error() can be used to look at the text of the last error
message sent by the server to to the client.
done for a style reason/to help clean up some concepts in the code.
-******
+------
RETURN
-******
+------
Varies, see particular functions.
-****
+----
HOME
-****
+----
To find out more information please check:
`https://launchpad.net/libmemcached <https://launchpad.net/libmemcached>`_
-******
-AUTHOR
-******
-
-
-Brian Aker, <brian@tangent.org>
-
--------
SEE ALSO
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Libmemcached library
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2006-2009 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <config.h>
+
+#include <cassert>
+
+#include <libtest/test.h>
+#include <libmemcached/memcached.h>
+#include <tests/deprecated.h>
+
+test_return_t server_list_null_test(memcached_st *ptr)
+{
+ memcached_server_st *server_list;
+ memcached_return_t rc;
+ (void)ptr;
+
+ server_list= memcached_server_list_append_with_weight(NULL, NULL, 0, 0, NULL);
+ test_true(server_list == NULL);
+
+ server_list= memcached_server_list_append_with_weight(NULL, "localhost", 0, 0, NULL);
+ test_true(server_list == NULL);
+
+ server_list= memcached_server_list_append_with_weight(NULL, NULL, 0, 0, &rc);
+ test_true(server_list == NULL);
+
+ return TEST_SUCCESS;
+}
+
+// Look for memory leak
+test_return_t regression_bug_728286(memcached_st *)
+{
+ memcached_server_st *servers = memcached_servers_parse("1.2.3.4:99");
+ assert(servers);
+ memcached_server_free(servers);
+
+ return TEST_SUCCESS;
+}
+
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Libmemcached library
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2006-2009 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+test_return_t server_list_null_test(memcached_st *ptr);
+test_return_t regression_bug_728286(memcached_st *);
+
+#ifdef __cplusplus
+}
+#endif
tests/ketama_test_cases_spy.h \
tests/libmemcached_world.h \
tests/parser.h \
+ tests/deprecated.h \
tests/pool.h \
tests/print.h \
tests/replication.h \
tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
tests_testapp_SOURCES= \
tests/basic.cc \
+ tests/deprecated.cc \
tests/error_conditions.cc \
tests/mem_functions.c \
tests/parser.cc \
-/* libMemcached Functions Test
- * Copyright (C) 2006-2009 Brian Aker
- * All rights reserved.
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Libmemcached library
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2006-2009 Brian Aker All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
*/
+
/*
Sample test application.
*/
#define SMALL_STRING_LEN 1024
#include <libtest/test.h>
+#include "tests/deprecated.h"
#include "tests/parser.h"
#include "tests/pool.h"
#include "tests/string.h"
return TEST_SUCCESS;
}
-static test_return_t server_list_null_test(memcached_st *ptr)
-{
- memcached_server_st *server_list;
- memcached_return_t rc;
- (void)ptr;
-
- server_list= memcached_server_list_append_with_weight(NULL, NULL, 0, 0, NULL);
- test_true(server_list == NULL);
-
- server_list= memcached_server_list_append_with_weight(NULL, "localhost", 0, 0, NULL);
- test_true(server_list == NULL);
-
- server_list= memcached_server_list_append_with_weight(NULL, NULL, 0, 0, &rc);
- test_true(server_list == NULL);
-
- return TEST_SUCCESS;
-}
-
#define TEST_PORT_COUNT 7
in_port_t test_ports[TEST_PORT_COUNT];
static test_return_t memcached_server_remove_test(memcached_st *ptr)
{
- memcached_return_t rc;
- memcached_st local_memc;
- memcached_st *memc;
- memcached_server_st *servers;
- memcached_server_fn callbacks[1];
-
- const char *server_string= "localhost:4444, localhost:4445, localhost:4446, localhost:4447, localhost, memcache1.memcache.bk.sapo.pt:11211, memcache1.memcache.bk.sapo.pt:11212, memcache1.memcache.bk.sapo.pt:11213, memcache1.memcache.bk.sapo.pt:11214, memcache2.memcache.bk.sapo.pt:11211, memcache2.memcache.bk.sapo.pt:11212, memcache2.memcache.bk.sapo.pt:11213, memcache2.memcache.bk.sapo.pt:11214";
+ const char *server_string= "--server=localhost:4444 --server=localhost:4445 --server=localhost:4446 --server=localhost:4447 --server=localhost --server=memcache1.memcache.bk.sapo.pt:11211 --server=memcache1.memcache.bk.sapo.pt:11212 --server=memcache1.memcache.bk.sapo.pt:11213 --server=memcache1.memcache.bk.sapo.pt:11214 --server=memcache2.memcache.bk.sapo.pt:11211 --server=memcache2.memcache.bk.sapo.pt:11212 --server=memcache2.memcache.bk.sapo.pt:11213 --server=memcache2.memcache.bk.sapo.pt:11214";
(void)ptr;
- memc= memcached_create(&local_memc);
-
- servers= memcached_servers_parse(server_string);
- assert(servers);
-
- rc= memcached_server_push(memc, servers);
- memcached_server_list_free(servers);
+ memcached_st *memc= memcached(server_string, strlen(server_string));
+ test_true(memc);
+ memcached_server_fn callbacks[1];
callbacks[0]= server_print_callback;
memcached_server_cursor(memc, callbacks, NULL, 1);
return TEST_SUCCESS;
}
-// Look for memory leak
-static test_return_t regression_bug_728286(memcached_st *unused)
-{
- (void)unused;
- memcached_server_st *servers = memcached_servers_parse("1.2.3.4:99");
- assert(servers);
- memcached_server_free(servers);
-
- return TEST_SUCCESS;
-}
-
static test_return_t regression_bug_581030(memcached_st *unused)
{
(void)unused;
#define BUILDING_LIBMEMCACHED
#include <libmemcached/memcached.h>
-#include <libmemcached/memcached.h>
#include "tests/parser.h"
#include "tests/print.h"