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