« blib/lib/Memcached/libmemcached/memcached_memory_allocators.pm
↑ Summary
blib/lib/Memcached/libmemcached/memcached_quit.pm »
| 1 | package Memcached::libmemcached::memcached_pool; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | memcached_pool_create, memcached_pool_destroy, memcached_pool_push, memcached_pool_pop - Manage pools | ||
| 6 | |||
| 7 | =head1 LIBRARY | ||
| 8 | |||
| 9 | C Client Library for memcached (libmemcachedutil, -lmemcachedutil) | ||
| 10 | |||
| 11 | =head1 SYNOPSIS | ||
| 12 | |||
| 13 | #include <libmemcached/memcached_pool.h> | ||
| 14 | |||
| 15 | memcached_pool_st * | ||
| 16 | memcached_pool_create(memcached_st* mmc, int initial, int max); | ||
| 17 | |||
| 18 | memcached_st * | ||
| 19 | memcached_pool_destroy(memcached_pool_st* pool); | ||
| 20 | |||
| 21 | memcached_st * | ||
| 22 | memcached_pool_pop (memcached_pool_st* pool, bool block, memcached_return_t *rc); | ||
| 23 | |||
| 24 | memcached_return_t | ||
| 25 | memcached_pool_push(memcached_pool_st* pool, memcached_st *mmc); | ||
| 26 | |||
| 27 | memcached_st *memcached_create (memcached_st *ptr); | ||
| 28 | |||
| 29 | memcached_return_t | ||
| 30 | memcached_pool_behavior_set(memcached_pool_st *pool, | ||
| 31 | memcached_behavior_t flag, | ||
| 32 | uint64_t data) | ||
| 33 | |||
| 34 | memcached_return_t | ||
| 35 | memcached_pool_behavior_get(memcached_pool_st *pool, | ||
| 36 | memcached_behavior_t flag, | ||
| 37 | uint64_t *value) | ||
| 38 | |||
| 39 | =head1 DESCRIPTION | ||
| 40 | |||
| 41 | memcached_pool_create() is used to create a connection pool of objects you | ||
| 42 | may use to remove the overhead of using memcached_clone for short | ||
| 43 | lived C<memcached_st> objects. The mmc argument should be an | ||
| 44 | initialised C<memcached_st> structure, and a successfull invocation of | ||
| 45 | memcached_pool_create takes full ownership of the variable (until it | ||
| 46 | is released by memcached_pool_destroy). The C<initial> argument | ||
| 47 | specifies the initial size of the connection pool, and the C<max> | ||
| 48 | argument specifies the maximum size the connection pool should grow | ||
| 49 | to. Please note that the library will allocate a fixed size buffer | ||
| 50 | scaled to the max size of the connection pool, so you should not pass | ||
| 51 | MAXINT or some other large number here. | ||
| 52 | |||
| 53 | memcached_pool_destroy() is used to destroy the connection pool | ||
| 54 | created with memcached_pool_create() and release all allocated | ||
| 55 | resources. It will return the pointer to the C<memcached_st> structure | ||
| 56 | passed as an argument to memcached_pool_create(), and returns the | ||
| 57 | ownership of the pointer to the caller. | ||
| 58 | |||
| 59 | memcached_pool_pop() is used to grab a connection structure from the | ||
| 60 | connection pool. The block argument specifies if the function should | ||
| 61 | block and wait for a connection structure to be available if we try | ||
| 62 | to exceed the maximum size. | ||
| 63 | |||
| 64 | memcached_pool_push() is used to return a connection structure back to the pool. | ||
| 65 | |||
| 66 | memcached_pool_behavior_set() and memcached_pool_behagior_get() is | ||
| 67 | used to get/set behavior flags on all connections in the pool. | ||
| 68 | |||
| 69 | |||
| 70 | =head1 RETURN | ||
| 71 | |||
| 72 | memcached_pool_create() returns a pointer to the newly created | ||
| 73 | memcached_pool_st structure. On an allocation failure, it returns | ||
| 74 | NULL. | ||
| 75 | |||
| 76 | memcached_pool_destroy() returns the pointer (and ownership) to the | ||
| 77 | memcached_st structure used to create the pool. If connections are in | ||
| 78 | use it returns NULL. | ||
| 79 | |||
| 80 | memcached_pool_pop() returns a pointer to a memcached_st structure | ||
| 81 | from the pool (or NULL if an allocation cannot be satisfied). | ||
| 82 | |||
| 83 | memcached_pool_push() returns MEMCACHED_SUCCESS upon success. | ||
| 84 | |||
| 85 | memcached_pool_behavior_get() and memcached_pool_behavior_get() | ||
| 86 | returns MEMCACHED_SUCCESS upon success. | ||
| 87 | |||
| 88 | =head1 HOME | ||
| 89 | |||
| 90 | To find out more information please check: | ||
| 91 | L<https://launchpad.net/libmemcached> | ||
| 92 | |||
| 93 | =head1 AUTHOR | ||
| 94 | |||
| 95 | Trond Norbye, E<lt>trond.norbye@gmail.comE<gt> | ||
| 96 | |||
| 97 | =head1 SEE ALSO | ||
| 98 | |||
| 99 | memcached(1) libmemcached(3) memcached_create(3) memcached_free(3) libmemcachedutil(3) memcached_behavior_get(3) memcached_behavior_set(3) | ||
| 100 | |||
| 101 | =cut | ||
| 102 | 1 | 1; |