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