1 ============================
2 Working with memcached pools
3 ============================
9 #include <libmemcached/memcached_pool.h>
10 Compile and link with -lmemcachedutil -lmemcached
12 .. type:: struct memcached_pool_st memcached_pool_st
14 .. function:: memcached_pool_st* memcached_pool(const char *option_string, size_t option_string_length)
16 .. function:: memcached_st* memcached_pool_destroy(memcached_pool_st* pool)
18 .. function:: memcached_st* memcached_pool_fetch(memcached_pool_st*, struct timespec* relative_time, memcached_return_t* rc)
19 .. versionadded:: 0.53
20 Synonym for memcached_pool_pop
22 .. function:: memcached_return_t memcached_pool_release(memcached_pool_st* pool, memcached_st* mmc)
23 .. versionadded:: 0.53
24 Synonym for memcached_pool_push.
26 .. function:: memcached_return_t memcached_pool_behavior_set(memcached_pool_st *pool, memcached_behavior_t flag, uint64_t data)
28 .. function:: memcached_return_t memcached_pool_behavior_get(memcached_pool_st *pool, memcached_behavior_t flag, uint64_t *value)
31 .. function:: memcached_pool_st* memcached_pool_create(memcached_st* mmc, int initial, int max)
33 Use :func:`memcached_pool`
35 .. function:: memcached_st* memcached_pool_pop(memcached_pool_st* pool, bool block, memcached_return_t *rc)
37 Use :func:`memcached_pool_fetch`
39 .. function:: memcached_return_t memcached_pool_push(memcached_pool_st* pool, memcached_st *mmc)
41 Use :func:`memcached_pool_release`
49 :func:`memcached_pool` is used to create a connection pool of objects you
50 may use to remove the overhead of using memcached_clone for short lived
51 :type:`memcached_st` objects. Please see :doc:`../libmemcached/configuration`
52 for details on the format of the configuration string.
54 :func:`memcached_pool_destroy` is used to destroy the connection pool
55 created with :func:`memcached_pool_create` and release all allocated
56 resources. It will return the pointer to the :type:`memcached_st` structure
57 passed as an argument to :func:`memcached_pool_create`, and returns the
58 ownership of the pointer to the caller when created with
59 :func:`memcached_pool_create`, otherwise NULL is returned..
61 :func:`memcached_pool_fetch` is used to fetch a connection structure from the
62 connection pool. The relative_time argument specifies if the function should
63 block and wait for a connection structure to be available if we try
64 to exceed the maximum size. You need to specify time in relative time.
66 :func:`memcached_pool_release` is used to return a connection structure back
69 :func:`memcached_pool_behavior_get` and :func:`memcached_pool_behavior_set`
70 is used to get/set behavior flags on all connections in the pool.
72 Both :func:`memcached_pool_release` and :func:`memcached_pool_fetch` are
79 :func:`memcached_pool_destroy` returns the pointer (and ownership) to the
80 :type:`memcached_st` structure used to create the pool. If connections are in
83 :func:`memcached_pool_pop` returns a pointer to a :type:`memcached_st`
84 structure from the pool (or NULL if an allocation cannot be satisfied).
86 :func:`memcached_pool_release` returns `MEMCACHED_SUCCESS` upon success.
88 :func:`memcached_pool_behavior_get` and :func:`memcached_pool_behavior_get`
89 returns `MEMCACHED_SUCCESS` upon success.
91 If any methods returns MEMCACHED_IN_PROGRESS then a lock on the pool could not
92 be obtained. If any of the parameters passed to any of these functions is
93 invalid, MEMCACHED_INVALID_ARGUMENTS will be returned.
95 memcached_pool_fetch may return MEMCACHED_TIMEOUT if a timeout occurs while
96 waiting for a free memcached_st. MEMCACHED_NOTFOUND if no memcached_st was
107 :manpage:`memcached(1)`
108 :manpage:`libmemcached(3)`
109 :manpage:`libmemcached_configuration(3)`
110 :manpage:`memcached_strerror(3)`
114 * :manpage:`memcached(1)`
115 * :doc:`../libmemcached`
116 * :doc:`../libmemcached/configuration`
117 * :doc:`../libmemcached/memcached_strerror`