« blib/lib/Memcached/libmemcached/memcached_get.pm
↑ Summary
blib/lib/Memcached/libmemcached/memcached_pool.pm »
| 1 | package Memcached::libmemcached::memcached_memory_allocators; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | memcached_set_memory_allocators, memcached_get_memory_allocators, memcached_set_memory_allocators_context - Manage memory allocator functions | ||
| 6 | |||
| 7 | =head1 LIBRARY | ||
| 8 | |||
| 9 | C Client Library for memcached (libmemcached, -lmemcached) | ||
| 10 | |||
| 11 | =head1 SYNOPSIS | ||
| 12 | |||
| 13 | #include <memcached.h> | ||
| 14 | |||
| 15 | memcached_return_t | ||
| 16 | memcached_set_memory_allocators (memcached_st *ptr, | ||
| 17 | memcached_malloc_fn mem_malloc, | ||
| 18 | memcached_free_fn mem_free, | ||
| 19 | memcached_realloc_fn mem_realloc, | ||
| 20 | memcached_calloc_fn mem_calloc, | ||
| 21 | void *context); | ||
| 22 | |||
| 23 | void | ||
| 24 | memcached_get_memory_allocators (memcached_st *ptr, | ||
| 25 | memcached_malloc_fn *mem_malloc, | ||
| 26 | memcached_free_fn *mem_free, | ||
| 27 | memcached_realloc_fn *mem_realloc, | ||
| 28 | memcached_calloc_fn *mem_calloc); | ||
| 29 | |||
| 30 | void * | ||
| 31 | memcached_get_memory_allocators_context(const memcached_st *ptr); | ||
| 32 | |||
| 33 | void * | ||
| 34 | (*memcached_malloc_fn) (memcached_st *ptr, const size_t size, | ||
| 35 | void *context); | ||
| 36 | |||
| 37 | void * | ||
| 38 | (*memcached_realloc_fn) (memcached_st *ptr, void *mem, | ||
| 39 | const size_t size, | ||
| 40 | void *context); | ||
| 41 | |||
| 42 | void | ||
| 43 | (*memcached_free_fn) (memcached_st *ptr, void *mem, | ||
| 44 | void *context); | ||
| 45 | |||
| 46 | void * | ||
| 47 | (*memcached_calloc_fn) (memcached_st *ptr, | ||
| 48 | size_t nelem, | ||
| 49 | const size_t elsize, | ||
| 50 | void *context); | ||
| 51 | |||
| 52 | |||
| 53 | =head1 DESCRIPTION | ||
| 54 | |||
| 55 | libmemcached(3) allows you to specify your own memory allocators optimized | ||
| 56 | for your application. | ||
| 57 | |||
| 58 | memcached_set_memory_allocators() is used to set the memory allocators used | ||
| 59 | by the memcached instance specified by ptr. Please note that you cannot | ||
| 60 | override only one of the memory allocators, you have to specify a complete | ||
| 61 | new set if you want to override one of them. All of the memory allocation | ||
| 62 | functions should behave as specified in the C99 standard. Specify NULL as | ||
| 63 | all functions to reset them to the default values. | ||
| 64 | |||
| 65 | memcached_get_memory_allocators() is used to get the currently used memory | ||
| 66 | allocators by a mamcached handle. | ||
| 67 | |||
| 68 | memcached_get_memory_allocators_context() returns the void * that was | ||
| 69 | passed in during the call to memcached_set_memory_allocators(). | ||
| 70 | |||
| 71 | The first argument to the memory allocator functions is a pointer to a | ||
| 72 | memcached structure, the is passed as const and you will need to clone | ||
| 73 | it in order to make use of any operation which would modify it. | ||
| 74 | |||
| 75 | =head1 NOTES | ||
| 76 | |||
| 77 | In version 0.38 all functions were modified to have a context void pointer | ||
| 78 | passed to them. This was so that customer allocators could have their | ||
| 79 | own space for memory. | ||
| 80 | |||
| 81 | =head1 RETURN | ||
| 82 | |||
| 83 | memcached_set_memory_allocators() return MEMCACHED_SUCCESS upon success, | ||
| 84 | and MEMCACHED_FAILURE if you don't pass a complete set of function pointers. | ||
| 85 | |||
| 86 | =head1 HOME | ||
| 87 | |||
| 88 | To find out more information please check: | ||
| 89 | L<https://launchpad.net/libmemcached> | ||
| 90 | |||
| 91 | =head1 AUTHOR | ||
| 92 | |||
| 93 | Trond Norbye, E<lt>trond.norbye@gmail.comE<gt> | ||
| 94 | Brian Aker, E<lt>brian@tangent.orf<gt> | ||
| 95 | |||
| 96 | =head1 SEE ALSO | ||
| 97 | |||
| 98 | memcached(1) libmemcached(3) memcached_get_user_data(3) memcached_set_user_data(3) | ||
| 99 | |||
| 100 | =cut | ||
| 101 | |||
| 102 | 1 | 1; |