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