Include config.h before any system header to avoid problems with FILE_OFFSET_BITS...
[m6w6/libmemcached] / docs / memcached_create.pod
1 =head1 NAME
2
3 memcached_create, memcached_free - Create a memcached_st structure
4
5 =head1 LIBRARY
6
7 C Client Library for memcached (libmemcached, -lmemcached)
8
9 =head1 SYNOPSIS
10
11 #include <memcached.h>
12
13 memcached_st *memcached_create (memcached_st *ptr);
14
15 void memcached_free (memcached_st *ptr);
16
17 memcached_st *memcached_clone(memcached_st *clone, memcached_st *source);
18
19 =head1 DESCRIPTION
20
21 memcached_create() is used to create a C<memcached_st> structure that will then
22 be used by other libmemcached(3) functions to communicate with the server. You
23 should either pass a statically declared C<memcached_st> to memcached_create() or
24 a NULL. If a NULL passed in then a structure is allocated for you.
25
26 memcached_clone() is similar to memcached_create(3) but it copies the
27 defaults and list of servers from the source C<memcached_st>. If you pass a null as
28 the argument for the source to clone, it is the same as a call to memcached_create().
29 If the clone argument is NULL a C<memcached_st> will be allocated for you.
30 If you pass a pointer to a memory area for the clone pointer, make sure you
31 memset it to 0 (unless you got the clone from a factory method in libmemcached).
32
33 To clean up memory associated with a C<memcached_st> structure you should pass
34 it to memcached_free() when you are finished using it. memcached_free() is
35 the only way to make sure all memory is deallocated when you finish using
36 the structure.
37
38 =head1 RETURN
39
40 memcached_create() returns a pointer to the memcached_st that was created
41 (or initialized). On an allocation failure, it returns NULL.
42
43 memcached_clone() returns a pointer to the memcached_st that was created
44 (or initialized). On an allocation failure, it returns NULL. If you pass in
45 a preallocated structure it must be cleared first (aka memset()).
46
47 =head1 HOME
48
49 To find out more information please check:
50 L<http://tangent.org/552/libmemcached.html>
51
52 =head1 AUTHOR
53
54 Brian Aker, E<lt>brian@tangent.orgE<gt>
55
56 =head1 SEE ALSO
57
58 memcached(1) libmemcached(3) memcached_strerror(3)
59
60 =cut
61