1beff43c507d6274d4a6c919d1dc98643c484a1c
[awesomized/libmemcached] / docs / memcached_create.rst
1 .. highlight:: perl
2
3
4 memcached_create, memcached_free, memcached_clone, memcached_servers_reset
5 **************************************************************************
6
7
8 Create a memcached_st structure
9
10
11 *******
12 LIBRARY
13 *******
14
15
16 C Client Library for memcached (libmemcached, -lmemcached)
17
18
19 ********
20 SYNOPSIS
21 ********
22
23
24
25 .. code-block:: perl
26
27 #include <libmemcached/memcached.h>
28
29 memcached_st *memcached_create (memcached_st *ptr);
30
31 void memcached_free (memcached_st *ptr);
32
33 memcached_st *memcached_clone (memcached_st *destination, memcached_st *source);
34
35 void memcached_servers_reset(memcached_st);
36
37
38
39 ***********
40 DESCRIPTION
41 ***********
42
43
44 memcached_create() is used to create a \ ``memcached_st``\ structure that will then
45 be used by other libmemcached(3) functions to communicate with the server. You
46 should either pass a statically declared \ ``memcached_st``\ to memcached_create() or
47 a NULL. If a NULL passed in then a structure is allocated for you.
48
49 memcached_clone() is similar to memcached_create(3) but it copies the
50 defaults and list of servers from the source \ ``memcached_st``\ . If you pass a null as
51 the argument for the source to clone, it is the same as a call to memcached_create().
52 If the destination argument is NULL a \ ``memcached_st``\ will be allocated for you.
53
54 memcached_servers_reset() allows you to zero out the list of servers that
55 the memcached_st has.
56
57 To clean up memory associated with a \ ``memcached_st``\ structure you should pass
58 it to memcached_free() when you are finished using it. memcached_free() is
59 the only way to make sure all memory is deallocated when you finish using
60 the structure.
61
62 You may wish to avoid using memcached_create(3) or memcached_clone(3) with a
63 stack based allocation. The most common issues related to ABI safety involve
64 heap allocated structures.
65
66
67 ******
68 RETURN
69 ******
70
71
72 memcached_create() returns a pointer to the memcached_st that was created
73 (or initialized). On an allocation failure, it returns NULL.
74
75 memcached_clone() returns a pointer to the memcached_st that was created
76 (or initialized). On an allocation failure, it returns NULL.
77
78
79 ****
80 HOME
81 ****
82
83
84 To find out more information please check:
85 `https://launchpad.net/libmemcached <https://launchpad.net/libmemcached>`_
86
87
88 ******
89 AUTHOR
90 ******
91
92
93 Brian Aker, <brian@tangent.org>
94
95
96 ********
97 SEE ALSO
98 ********
99
100
101 memcached(1) libmemcached(3) memcached_strerror(3)
102