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