9 memcached_pool_create, memcached_pool_destroy, memcached_pool_push, memcached_pool_pop - Manage pools
17 C Client Library for memcached (libmemcachedutil, -lmemcachedutil)
28 #include <libmemcached/memcached_pool.h>
31 memcached_pool_create(memcached_st* mmc, int initial, int max);
34 memcached_pool_destroy(memcached_pool_st* pool);
37 memcached_pool_pop (memcached_pool_st* pool, bool block, memcached_return_t *rc);
40 memcached_pool_push(memcached_pool_st* pool, memcached_st *mmc);
42 memcached_st *memcached_create (memcached_st *ptr);
45 memcached_pool_behavior_set(memcached_pool_st *pool,
46 memcached_behavior_t flag,
50 memcached_pool_behavior_get(memcached_pool_st *pool,
51 memcached_behavior_t flag,
61 memcached_pool_create() is used to create a connection pool of objects you
62 may use to remove the overhead of using memcached_clone for short
63 lived \ ``memcached_st``\ objects. The mmc argument should be an
64 initialised \ ``memcached_st``\ structure, and a successfull invocation of
65 memcached_pool_create takes full ownership of the variable (until it
66 is released by memcached_pool_destroy). The \ ``initial``\ argument
67 specifies the initial size of the connection pool, and the \ ``max``\
68 argument specifies the maximum size the connection pool should grow
69 to. Please note that the library will allocate a fixed size buffer
70 scaled to the max size of the connection pool, so you should not pass
71 MAXINT or some other large number here.
73 memcached_pool_destroy() is used to destroy the connection pool
74 created with memcached_pool_create() and release all allocated
75 resources. It will return the pointer to the \ ``memcached_st``\ structure
76 passed as an argument to memcached_pool_create(), and returns the
77 ownership of the pointer to the caller.
79 memcached_pool_pop() is used to grab a connection structure from the
80 connection pool. The block argument specifies if the function should
81 block and wait for a connection structure to be available if we try
82 to exceed the maximum size.
84 memcached_pool_push() is used to return a connection structure back to the pool.
86 memcached_pool_behavior_set() and memcached_pool_behagior_get() is
87 used to get/set behavior flags on all connections in the pool.
95 memcached_pool_create() returns a pointer to the newly created
96 memcached_pool_st structure. On an allocation failure, it returns
99 memcached_pool_destroy() returns the pointer (and ownership) to the
100 memcached_st structure used to create the pool. If connections are in
103 memcached_pool_pop() returns a pointer to a memcached_st structure
104 from the pool (or NULL if an allocation cannot be satisfied).
106 memcached_pool_push() returns MEMCACHED_SUCCESS upon success.
108 memcached_pool_behavior_get() and memcached_pool_behavior_get()
109 returns MEMCACHED_SUCCESS upon success.
117 To find out more information please check:
118 `https://launchpad.net/libmemcached <https://launchpad.net/libmemcached>`_
126 Trond Norbye, <trond.norbye@gmail.com>
134 memcached(1) libmemcached(3) memcached_create(3) memcached_free(3) libmemcachedutil(3) memcached_behavior_get(3) memcached_behavior_set(3)