Updates for documentation style/etc.
[m6w6/libmemcached] / docs / memcached_pool.rst
1 .. highlight:: perl
2
3
4 memcached_pool_create, memcached_pool_destroy, memcached_pool_push, memcached_pool_pop
5 **************************************************************************************
6
7
8 Manage pools
9
10
11 *******
12 LIBRARY
13 *******
14
15
16 C Client Library for memcached (libmemcachedutil, -lmemcachedutil)
17
18
19 ********
20 SYNOPSIS
21 ********
22
23
24
25 .. code-block:: perl
26
27 #include <libmemcached/memcached_pool.h>
28
29 memcached_pool_st *
30 memcached_pool_create(memcached_st* mmc, int initial, int max);
31
32 memcached_st *
33 memcached_pool_destroy(memcached_pool_st* pool);
34
35 memcached_st *
36 memcached_pool_pop (memcached_pool_st* pool, bool block, memcached_return_t *rc);
37
38 memcached_return_t
39 memcached_pool_push(memcached_pool_st* pool, memcached_st *mmc);
40
41 memcached_st *memcached_create (memcached_st *ptr);
42
43 memcached_return_t
44 memcached_pool_behavior_set(memcached_pool_st *pool,
45 memcached_behavior_t flag,
46 uint64_t data)
47
48 memcached_return_t
49 memcached_pool_behavior_get(memcached_pool_st *pool,
50 memcached_behavior_t flag,
51 uint64_t *value)
52
53
54
55 ***********
56 DESCRIPTION
57 ***********
58
59
60 memcached_pool_create() is used to create a connection pool of objects you
61 may use to remove the overhead of using memcached_clone for short
62 lived \ ``memcached_st``\ objects. The mmc argument should be an
63 initialised \ ``memcached_st``\ structure, and a successfull invocation of
64 memcached_pool_create takes full ownership of the variable (until it
65 is released by memcached_pool_destroy). The \ ``initial``\ argument
66 specifies the initial size of the connection pool, and the \ ``max``\
67 argument specifies the maximum size the connection pool should grow
68 to. Please note that the library will allocate a fixed size buffer
69 scaled to the max size of the connection pool, so you should not pass
70 MAXINT or some other large number here.
71
72 memcached_pool_destroy() is used to destroy the connection pool
73 created with memcached_pool_create() and release all allocated
74 resources. It will return the pointer to the \ ``memcached_st``\ structure
75 passed as an argument to memcached_pool_create(), and returns the
76 ownership of the pointer to the caller.
77
78 memcached_pool_pop() is used to grab a connection structure from the
79 connection pool. The block argument specifies if the function should
80 block and wait for a connection structure to be available if we try
81 to exceed the maximum size.
82
83 memcached_pool_push() is used to return a connection structure back to the pool.
84
85 memcached_pool_behavior_set() and memcached_pool_behagior_get() is
86 used to get/set behavior flags on all connections in the pool.
87
88
89 ******
90 RETURN
91 ******
92
93
94 memcached_pool_create() returns a pointer to the newly created
95 memcached_pool_st structure. On an allocation failure, it returns
96 NULL.
97
98 memcached_pool_destroy() returns the pointer (and ownership) to the
99 memcached_st structure used to create the pool. If connections are in
100 use it returns NULL.
101
102 memcached_pool_pop() returns a pointer to a memcached_st structure
103 from the pool (or NULL if an allocation cannot be satisfied).
104
105 memcached_pool_push() returns MEMCACHED_SUCCESS upon success.
106
107 memcached_pool_behavior_get() and memcached_pool_behavior_get()
108 returns MEMCACHED_SUCCESS upon success.
109
110
111 ****
112 HOME
113 ****
114
115
116 To find out more information please check:
117 `https://launchpad.net/libmemcached <https://launchpad.net/libmemcached>`_
118
119
120 ******
121 AUTHOR
122 ******
123
124
125 Trond Norbye, <trond.norbye@gmail.com>
126
127
128 ********
129 SEE ALSO
130 ********
131
132 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`