![background image](http://html1.mh-extra.com/html/oracle/5-0/5-0_reference-manual_16461961382.webp)
Developing a
memcached
Application
1362
To build the application, specify the
memcached
library:
shell> gcc -o memc_basic memc_basic.c -lmemcached
Running the above sample application, after starting a
memcached
server, should return a success
message:
shell> memc_basic
Added server successfully
Key stored successfully
15.6.3.3.1.
libmemcached
Base Functions
The base
libmemcached
functions let you create, destroy and clone the main
memcached_st
structure that is used to interface with the
memcached
servers. The main functions are defined below:
memcached_st *memcached_create (memcached_st *ptr);
Creates a new
memcached_st
structure for use with the other
libmemcached
API functions. You
can supply an existing, static,
memcached_st
structure, or
NULL
to have a new structured allocated.
Returns a pointer to the created structure, or
NULL
on failure.
void memcached_free (memcached_st *ptr);
Frees the structure and memory allocated to a previously created
memcached_st
structure.
memcached_st *memcached_clone(memcached_st *clone, memcached_st *source);
Clones an existing
memcached
structure from the specified
source
, copying the defaults and list of
servers defined in the structure.
15.6.3.3.2.
libmemcached
Server Functions
The
libmemcached
API uses a list of servers, stored within the
memcached_server_st
structure,
to act as the list of servers used by the rest of the functions. To use
memcached
, you first create the
server list, and then apply the list of servers to a valid
libmemcached
object.
Because the list of servers, and the list of servers within an active
libmemcached
object can be
manipulated separately, you can update and manage server lists while an active
libmemcached
interface is running.
The functions for manipulating the list of servers within a
memcached_st
structure are:
memcached_return
memcached_server_add (memcached_st *ptr,
char *hostname,
unsigned int port);
Adds a server, using the given
hostname
and
port
into the
memcached_st
structure given in
ptr
.
memcached_return
memcached_server_add_unix_socket (memcached_st *ptr,
char *socket);
Adds a Unix socket to the list of servers configured in the
memcached_st
structure.
unsigned int memcached_server_count (memcached_st *ptr);
Returns a count of the number of configured servers within the
memcached_st
structure.
memcached_server_st *
memcached_server_list (memcached_st *ptr);
Returns an array of all the defined hosts within a
memcached_st
structure.
memcached_return
memcached_server_push (memcached_st *ptr,
memcached_server_st *list);
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...