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