3 memcached_callback_get memcached_callback_set
7 C Client Library for memcached (libmemcached, -lmemcached)
11 #include <memcached.h>
14 memcached_callback_set (memcached_st *ptr,
15 memcached_callback flag,
19 memcached_callback_get (memcached_st *ptr,
20 memcached_callback flag,
21 memcached_return *error);
25 libmemcached(3) can have callbacks set key execution points. These either
26 provide function calls at points in the code, or return pointers to
27 structures for particular usages.
29 memcached_callback_get() takes a callback flag and returns the structure or
30 function set by memcached_callback_set().
32 memcached_callback_set() changes the function/structure assigned by a
33 callback flag. No connections are reset.
37 =item MEMCACHED_CALLBACK_CLEANUP_FUNCTION
39 When memcached_delete() is called this function will be excuted. At the
40 point of its execution all connections have been closed.
42 =item MEMCACHED_CALLBACK_CLONE_FUNCTION
44 When memcached_delete() is called this function will be excuted. At the
45 point of its execution all connections have been closed.
47 =item MEMCACHED_CALLBACK_USER_DATA
49 This allows you to store a pointer to a specifc piece of data. This can be
50 retrieved from inside of memcached_fetch_execute(). Cloning a memcached_st
51 will copy the pointer to the clone.
53 =item MEMCACHED_CALLBACK_MALLOC_FUNCTION,
55 This alllows yout to pass in a customized version of malloc that will be used instead of the builtin malloc(3) call.
56 The prototype for this is:
58 void *(*memcached_malloc_function)(memcached_st *ptr, const size_t size);
60 You can use MEMCACHED_CALLBACK_USER_DATA to provide custom context if required for malloc.
62 =item MEMCACHED_CALLBACK_REALLOC_FUNCTION,
64 This alllows yout to pass in a customized version of realloc that will be used instead of the builtin realloc(3) call.
65 The prototype for this is:
67 void *(*memcached_realloc_function)(memcached_st *ptr, void *mem, const size_t size);
69 You can use MEMCACHED_CALLBACK_USER_DATA to provide custom context if required for realloc.
71 =item MEMCACHED_CALLBACK_FREE_FUNCTION,
73 This alllows yout to pass in a customized version of realloc that will be used instead of the builtin free(3) call.
74 The prototype for this is:
76 typedef void (*memcached_free_function)(memcached_st *ptr, void *mem);
78 You can use MEMCACHED_CALLBACK_USER_DATA to provide custom context if required for realloc.
84 memcached_callback_get() return the function or structure that was provided.
85 Upon error, nothing is set, null is returned, and the memcached_return
86 argument is set to MEMCACHED_FAILURE.
88 memcached_callback_set() returns MEMCACHED_SUCCESS upon successful setting,
89 otherwise MEMCACHED_FAILURE on error.
93 To find out more information please check:
94 L<http://tangent.org/552/libmemcached.html>
98 Brian Aker, E<lt>brian@tangent.orgE<gt>
102 memcached(1) libmemcached(3) memcached_strerror(3)