1 ============================
2 Working with memcached pools
3 ============================
5 .. index:: object: memcached_pool_st
11 #include <libmemcached/memcached_pool.h>
13 .. c:function:: memcached_pool_st *memcached_pool(const char *option_string, size_t option_string_length);
15 .. c:function:: memcached_pool_st * memcached_pool_create(memcached_st* mmc, int initial, int max); DEPRECATED
17 .. c:function:: memcached_st * memcached_pool_destroy(memcached_pool_st* pool);
19 .. c:function:: memcached_st * memcached_pool_pop (memcached_pool_st* pool, bool block, memcached_return_t *rc);
21 .. c:function:: memcached_return_t memcached_pool_push(memcached_pool_st* pool, memcached_st *mmc);
23 .. c:function:: memcached_st *memcached_create (memcached_st *ptr);
25 .. c:function:: memcached_return_t memcached_pool_behavior_set(memcached_pool_st *pool, memcached_behavior_t flag, uint64_t data)
27 .. c:function:: memcached_return_t memcached_pool_behavior_get(memcached_pool_st *pool, memcached_behavior_t flag, uint64_t *value)
29 Compile and link with -lmemcachedutil -lmemcached
37 :c:func:`memcached_pool()` is used to create a connection pool of objects you
38 may use to remove the overhead of using memcached_clone for short lived
39 :c:type:`memcached_st` objects. Please see :manpage:`libmemcached_configuration` for details on the format of the configuration string.
41 DEPRECATED :c:func:`memcached_pool_create()` is used to create a connection pool of objects you may use to remove the overhead of using
42 :c:type:`memcached_clone` for short lived :c:type:`memcached_st` objects.
43 The mmc argument should be an initialised :c:type:`memcached_st` structure,
44 and a successfull invocation of :c:type:`memcached_pool_create` takes full
45 ownership of the variable (until it is released by
46 :c:type:`memcached_pool_destroy`). The :c:type:`initial` argument specifies
47 the initial size of the connection pool, and the :c:type:`max` argument
48 specifies the maximum size the connection pool should grow to. Please note
49 that the library will allocate a fixed size buffer scaled to the max size of
50 the connection pool, so you should not pass MAXINT or some other large
53 :c:func:`memcached_pool_destroy()` is used to destroy the connection pool
54 created with :c:func:`memcached_pool_create()` and release all allocated
55 resources. It will return the pointer to the :c:type:`memcached_st` structure
56 passed as an argument to :c:func:`memcached_pool_create()`, and returns the ownership of the pointer to the caller when created with :c:func:`memcached_pool_create()`, otherwise NULL is returned..
58 :c:func:`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.
63 :c:func:`memcached_pool_push()` is used to return a connection structure back to the pool.
65 :c:func:`memcached_pool_behavior_set()` and :c:func:`memcached_pool_behagior_get()` is used to get/set behavior flags on all connections in the pool.
73 :c:func:`memcached_pool_create()` returns a pointer to the newly created
74 :c:type:`memcached_pool_st` structure. On an allocation failure, it returns
77 :c:func:`memcached_pool_destroy()` returns the pointer (and ownership) to the
78 :c:type:`memcached_st` structure used to create the pool. If connections are in
81 :c:func:`memcached_pool_pop()` returns a pointer to a :c:type:`memcached_st structure` from the pool (or NULL if an allocation cannot be satisfied).
83 :c:func:`memcached_pool_push()` returns :c:type:`MEMCACHED_SUCCESS` upon success.
85 :c:func:`memcached_pool_behavior_get()` and :c:func:`memcached_pool_behavior_get()` returns :c:type:`MEMCACHED_SUCCESS` upon success.
93 To find out more information please check:
94 `http://libmemcached.org/ <http://libmemcached.org/>`_
102 Brian Aker, <brian@tangent.org>
104 Trond Norbye, <trond.norbye@gmail.com>
111 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`