1 Working with memcached pools
2 ============================
7 #include <libmemcached/memcached_pool.h>
8 Compile and link with -lmemcachedutil -lmemcached
10 .. type:: struct memcached_pool_st memcached_pool_st
12 .. function:: memcached_pool_st* memcached_pool(const char *option_string, size_t option_string_length)
14 .. function:: memcached_st* memcached_pool_destroy(memcached_pool_st* pool)
16 .. function:: memcached_st* memcached_pool_fetch(memcached_pool_st*, struct timespec* relative_time, memcached_return_t* rc)
17 .. versionadded:: 0.53
18 Synonym for memcached_pool_pop
20 .. function:: memcached_return_t memcached_pool_release(memcached_pool_st* pool, memcached_st* mmc)
21 .. versionadded:: 0.53
22 Synonym for memcached_pool_push.
24 .. function:: memcached_return_t memcached_pool_behavior_set(memcached_pool_st *pool, memcached_behavior_t flag, uint64_t data)
26 .. function:: memcached_return_t memcached_pool_behavior_get(memcached_pool_st *pool, memcached_behavior_t flag, uint64_t *value)
28 .. function:: memcached_pool_st* memcached_pool_create(memcached_st* mmc, int initial, int max)
30 Use :func:`memcached_pool`
32 .. function:: memcached_st* memcached_pool_pop(memcached_pool_st* pool, bool block, memcached_return_t *rc)
34 Use :func:`memcached_pool_fetch`
36 .. function:: memcached_return_t memcached_pool_push(memcached_pool_st* pool, memcached_st *mmc)
38 Use :func:`memcached_pool_release`
43 :func:`memcached_pool` is used to create a connection pool of objects you
44 may use to remove the overhead of using memcached_clone for short lived
45 :type:`memcached_st` objects. Please see :doc:`../libmemcached/configuration`
46 for details on the format of the configuration string.
48 :func:`memcached_pool_destroy` is used to destroy the connection pool
49 created with :func:`memcached_pool_create` and release all allocated
50 resources. It will return the pointer to the :type:`memcached_st` structure
51 passed as an argument to :func:`memcached_pool_create`, and returns the
52 ownership of the pointer to the caller when created with
53 :func:`memcached_pool_create`, otherwise NULL is returned..
55 :func:`memcached_pool_fetch` is used to fetch a connection structure from the
56 connection pool. The relative_time argument specifies if the function should
57 block and wait for a connection structure to be available if we try
58 to exceed the maximum size. You need to specify time in relative time.
60 :func:`memcached_pool_release` is used to return a connection structure back
63 :func:`memcached_pool_behavior_get` and :func:`memcached_pool_behavior_set`
64 is used to get/set behavior flags on all connections in the pool.
66 Both :func:`memcached_pool_release` and :func:`memcached_pool_fetch` are
72 :func:`memcached_pool_destroy` returns the pointer (and ownership) to the
73 :type:`memcached_st` structure used to create the pool. If connections are in
76 :func:`memcached_pool_pop` returns a pointer to a :type:`memcached_st`
77 structure from the pool (or NULL if an allocation cannot be satisfied).
79 :func:`memcached_pool_release` returns `MEMCACHED_SUCCESS` upon success.
81 :func:`memcached_pool_behavior_get` and :func:`memcached_pool_behavior_get`
82 returns `MEMCACHED_SUCCESS` upon success.
84 If any methods returns MEMCACHED_IN_PROGRESS then a lock on the pool could not
85 be obtained. If any of the parameters passed to any of these functions is
86 invalid, MEMCACHED_INVALID_ARGUMENTS will be returned.
88 memcached_pool_fetch may return MEMCACHED_TIMEOUT if a timeout occurs while
89 waiting for a free memcached_st. MEMCACHED_NOTFOUND if no memcached_st was
97 :manpage:`memcached(1)`
98 :manpage:`libmemcached(3)`
99 :manpage:`libmemcached_configuration(3)`
100 :manpage:`memcached_strerror(3)`
104 * :manpage:`memcached(1)`
105 * :doc:`../libmemcached`
106 * :doc:`../libmemcached/configuration`
107 * :doc:`../libmemcached/memcached_strerror`