docs: sanitize
[awesomized/libmemcached] / docs / source / libmemcachedutil / memcached_pool.rst
1 Working with memcached pools
2 ============================
3
4 SYNOPSIS
5 --------
6
7 #include <libmemcachedutil-|libmemcached_version|/pool.h>
8 Compile and link with -lmemcachedutil -lmemcached
9
10 .. type:: struct memcached_pool_st memcached_pool_st
11
12 .. function:: memcached_pool_st* memcached_pool(const char *option_string, size_t option_string_length)
13
14 .. function:: memcached_st* memcached_pool_destroy(memcached_pool_st* pool)
15
16 .. function:: memcached_st* memcached_pool_fetch(memcached_pool_st*, struct timespec* relative_time, memcached_return_t* rc)
17
18 .. versionadded:: 0.53
19 Synonym for memcached_pool_pop
20
21 .. function:: memcached_return_t memcached_pool_release(memcached_pool_st* pool, memcached_st* mmc)
22
23 .. versionadded:: 0.53
24 Synonym for memcached_pool_push.
25
26 .. function:: memcached_return_t memcached_pool_behavior_set(memcached_pool_st *pool, memcached_behavior_t flag, uint64_t data)
27
28 .. function:: memcached_return_t memcached_pool_behavior_get(memcached_pool_st *pool, memcached_behavior_t flag, uint64_t *value)
29
30 .. function:: memcached_pool_st* memcached_pool_create(memcached_st* mmc, int initial, int max)
31
32 .. deprecated:: 0.46
33 Use `memcached_pool`
34
35 .. function:: memcached_st* memcached_pool_pop(memcached_pool_st* pool, bool block, memcached_return_t *rc)
36
37 .. deprecated:: 0.53
38 Use `memcached_pool_fetch`
39
40 .. function:: memcached_return_t memcached_pool_push(memcached_pool_st* pool, memcached_st *mmc)
41
42 .. deprecated:: 0.53
43 Use `memcached_pool_release`
44
45 DESCRIPTION
46 -----------
47
48 `memcached_pool` is used to create a connection pool of objects you may use to
49 remove the overhead of using memcached_clone for short lived `memcached_st`
50 objects. Please see :doc:`../libmemcached/configuration` for details on the
51 format of the configuration string.
52
53 `memcached_pool_destroy` is used to destroy the connection pool created with
54 `memcached_pool_create` and release all allocated resources. It will return the
55 pointer to the `memcached_st` structure passed as an argument to
56 `memcached_pool_create`, and returns the ownership of the pointer to the caller
57 when created with `memcached_pool_create`, otherwise NULL is returned..
58
59 `memcached_pool_fetch` is used to fetch a connection structure from the
60 connection pool. The relative_time argument specifies if the function should
61 block and wait for a connection structure to be available if we try to exceed
62 the maximum size. You need to specify time in relative time.
63
64 `memcached_pool_release` is used to return a connection structure back to the
65 pool.
66
67 `memcached_pool_behavior_get` and `memcached_pool_behavior_set` is used to
68 get/set behavior flags on all connections in the pool.
69
70 Both `memcached_pool_release` and `memcached_pool_fetch` are thread safe.
71
72 RETURN VALUE
73 ------------
74
75 `memcached_pool_destroy` returns the pointer (and ownership) to the
76 `memcached_st` structure used to create the pool. If connections are in use it
77 returns NULL.
78
79 `memcached_pool_pop` returns a pointer to a `memcached_st` structure from the
80 pool (or NULL if an allocation cannot be satisfied).
81
82 `memcached_pool_release` returns `MEMCACHED_SUCCESS` upon success.
83
84 `memcached_pool_behavior_get` and `memcached_pool_behavior_get` returns
85 `MEMCACHED_SUCCESS` upon success.
86
87 If any methods returns MEMCACHED_IN_PROGRESS then a lock on the pool could not
88 be obtained. If any of the parameters passed to any of these functions is
89 invalid, MEMCACHED_INVALID_ARGUMENTS will be returned.
90
91 memcached_pool_fetch may return MEMCACHED_TIMEOUT if a timeout occurs while
92 waiting for a free memcached_st. MEMCACHED_NOTFOUND if no memcached_st was
93 available.
94
95 SEE ALSO
96 --------
97
98 .. only:: man
99
100 :manpage:`memcached(1)`
101 :manpage:`libmemcached(3)`
102 :manpage:`libmemcached_configuration(3)`
103 :manpage:`memcached_strerror(3)`
104
105 .. only:: html
106
107 * :manpage:`memcached(1)`
108 * :doc:`../libmemcached`
109 * :doc:`../libmemcached/configuration`
110 * :doc:`../libmemcached/memcached_strerror`