1MEMCACHED_CALLBACK_SET(3)        libmemcached        MEMCACHED_CALLBACK_SET(3)
2
3
4

NAME

6       memcached_callback_set - libmemcached Documentation
7
8       Get and set a callback
9

SYNOPSIS

11       #include <libmemcached/memcached.h>
12
13       memcached_callback_t
14
15       memcached_return_t            memcached_callback_set(memcached_st *ptr,
16       memcached_callback_t flag, const void *data)
17
18       void            *             memcached_callback_get(memcached_st *ptr,
19       memcached_callback_t flag, memcached_return_t *error)
20
21       Compile and link with -lmemcached
22

DESCRIPTION

24       libmemcached(3)  can  have  callbacks  set  key execution points. These
25       either provide function calls at points in the code, or return pointers
26       to structures for particular usages.
27
28       memcached_callback_get()  takes  a callback flag and returns the struc‐
29       ture or function set by memcached_callback_set().
30
31       memcached_callback_set() changes the function/structure assigned  by  a
32       callback flag. No connections are reset.
33
34       You  can  use MEMCACHED_CALLBACK_USER_DATA to provide custom context if
35       required for any of the callbacks.
36
37       MEMCACHED_CALLBACK_CLEANUP_FUNCTION
38
39       When memcached_delete() is called this function will be excuted. At the
40       point of its execution all connections are closed.
41
42       MEMCACHED_CALLBACK_CLONE_FUNCTION
43
44       When  memcached_delete()  is  called this function will be excuted.  At
45       the point of its execution all connections are closed.
46
47       MEMCACHED_CALLBACK_PREFIX_KEY
48              See MEMCACHED_CALLBACK_NAMESPACE
49
50       MEMCACHED_CALLBACK_NAMESPACE
51
52       You can set a value which will be used to  create  a  domain  for  your
53       keys.   The value specified here will be prefixed to each of your keys.
54       The value can not be greater then MEMCACHED_PREFIX_KEY_MAX_SIZE - 1 and
55       will reduce MEMCACHED_MAX_KEY by the value of your key.
56
57       The  prefix key is only applied to the primary key, not the master key.
58       MEMCACHED_FAILURE will be returned if no key is set. In the case  of  a
59       key which is too long, MEMCACHED_BAD_KEY_PROVIDED will be returned.
60
61       If  you  set  a  value with the value being NULL then the prefix key is
62       disabled.
63
64       MEMCACHED_CALLBACK_USER_DATA
65
66       This allows you to store a pointer to a specifc piece of data. This can
67       be  retrieved  from inside of memcached_fetch_execute(). Cloning a mem‐
68       cached_st will copy the pointer to the clone.
69
70       MEMCACHED_CALLBACK_MALLOC_FUNCTION
71
72       Deprecated since  version  <0.32:  Use  memcached_set_memory_allocators
73       instead.
74
75       MEMCACHED_CALLBACK_REALLOC_FUNCTION
76
77       Deprecated  since  version  <0.32:  Use memcached_set_memory_allocators
78       instead.
79
80       MEMCACHED_CALLBACK_FREE_FUNCTION
81
82       Deprecated since  version  <0.32:  Use  memcached_set_memory_allocators
83       instead.
84
85       MEMCACHED_CALLBACK_GET_FAILURE
86
87       This function implements the read through cache behavior. On failure of
88       retrieval this callback will be called.
89
90       You are responsible for populating the  result  object  provided.  This
91       result  object  will  then  be stored in the server and returned to the
92       calling process.
93
94       You must clone the memcached_st in order to make use of it.  The  value
95       will   be   stored   only  if  you  return  MEMCACHED_SUCCESS  or  MEM‐
96       CACHED_BUFFERED. Returning MEMCACHED_BUFFERED will cause the object  to
97       be  buffered  and  not sent immediatly (if this is the default behavior
98       based on your connection setup this will happen automatically).
99
100       The prototype for this is:
101
102       memcached_return_t  (*memcached_trigger_key)(memcached_st  *ptr,   char
103       *key, size_t key_length, memcached_result_st *result);
104
105       MEMCACHED_CALLBACK_DELETE_TRIGGER
106
107       This  function  implements a trigger upon successful deletion of a key.
108       The memcached_st structure will need to be cloned in order to make  use
109       of it.
110
111       The prototype for this is:
112
113       typedef memcached_return_t (*memcached_trigger_delete_key)(memcached_st
114       *ptr, char *key, size_t key_length);
115

RETURN

117       memcached_callback_get() return the function or structure that was pro‐
118       vided.  Upon  error,  nothing  is  set,  null is returned, and the mem‐
119       cached_return_t argument is set to MEMCACHED_FAILURE.
120
121       memcached_callback_set() returns MEMCACHED_SUCCESS upon successful set‐
122       ting, otherwise MEMCACHED_FAILURE on error.
123

HOME

125       To find out more information please check: http://libmemcached.org/
126

AUTHOR

128       Brian Aker, <brian@tangent.org>
129

SEE ALSO

131       memcached(1) libmemcached(3) memcached_strerror(3)
132

AUTHOR

134       Brian Aker
135
137       2011-2013, Brian Aker DataDifferential, http://datadifferential.com/
138
139
140
141
1421.0.18                         February 09, 2014     MEMCACHED_CALLBACK_SET(3)
Impressum