1 .TH "MEMCACHED_CALLBACK_SET" "3" "April 08, 2011" "0.47" "libmemcached"
3 memcached_callback_set \- libmemcached Documentation
5 .nr rst2man-indent-level 0
9 level \\n[rst2man-indent-level]
10 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
17 .\" .rstReportMargin pre:
19 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
20 . nr rst2man-indent-level +1
21 .\" .rstReportMargin post:
25 .\" indent \\n[an-margin]
26 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
27 .nr rst2man-indent-level -1
28 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
29 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
31 .\" Man page generated from reStructeredText.
34 Get and set a callback
37 C Client Library for memcached (libmemcached, \-lmemcached)
42 #include <libmemcached/memcached.h>
45 memcached_callback_set (memcached_st *ptr,
46 memcached_callback_t flag,
50 memcached_callback_get (memcached_st *ptr,
51 memcached_callback_t flag,
52 memcached_return_t *error);
57 libmemcached(3) can have callbacks set key execution points. These either
58 provide function calls at points in the code, or return pointers to
59 structures for particular usages.
61 memcached_callback_get() takes a callback flag and returns the structure or
62 function set by memcached_callback_set().
64 memcached_callback_set() changes the function/structure assigned by a
65 callback flag. No connections are reset.
67 You can use MEMCACHED_CALLBACK_USER_DATA to provide custom context if required for any
70 MEMCACHED_CALLBACK_CLEANUP_FUNCTION
74 When memcached_delete() is called this function will be excuted. At the
75 point of its execution all connections have been closed.
79 MEMCACHED_CALLBACK_CLONE_FUNCTION
83 When memcached_delete() is called this function will be excuted. At the
84 point of its execution all connections have been closed.
88 MEMCACHED_CALLBACK_PREFIX_KEY
92 You can set a value which will be used to create a domain for your keys.
93 The value specified here will be prefixed to each of your keys. The value can not
94 be greater then MEMCACHED_PREFIX_KEY_MAX_SIZE \- 1 and will reduce MEMCACHED_MAX_KEY by
95 the value of your key. The prefix key is only applied to the primary key,
96 not the master key. MEMCACHED_FAILURE will be returned if no key is set. In the case
97 of a key which is too long MEMCACHED_BAD_KEY_PROVIDED will be returned.
99 If you set a value with the value being NULL then the prefix key is disabled.
103 MEMCACHED_CALLBACK_USER_DATA
107 This allows you to store a pointer to a specifc piece of data. This can be
108 retrieved from inside of memcached_fetch_execute(). Cloning a memcached_st
109 will copy the pointer to the clone.
113 MEMCACHED_CALLBACK_MALLOC_FUNCTION
117 DEPRECATED: use memcached_set_memory_allocators instead.
121 MEMCACHED_CALLBACK_REALLOC_FUNCTION
125 DEPRECATED: use memcached_set_memory_allocators instead.
129 MEMCACHED_CALLBACK_FREE_FUNCTION
133 DEPRECATED: use memcached_set_memory_allocators instead.
137 MEMCACHED_CALLBACK_GET_FAILURE
141 This function implements the read through cache behavior. On failure of retrieval this callback will be called.
142 You are responsible for populating the result object provided. This result object will then be stored in the server and
143 returned to the calling process. You must clone the memcached_st in order to
144 make use of it. The value will be stored only if you return
145 MEMCACHED_SUCCESS or MEMCACHED_BUFFERED. Returning MEMCACHED_BUFFERED will
146 cause the object to be buffered and not sent immediatly (if this is the default behavior based on your connection setup this will happen automatically).
148 The prototype for this is:
149 memcached_return_t (*memcached_trigger_key)(memcached_st *ptr, char *key, size_t key_length, memcached_result_st *result);
153 MEMCACHED_CALLBACK_DELETE_TRIGGER
157 This function implements a trigger upon successful deletion of a key. The memcached_st structure will need to be cloned
158 in order to make use of it.
160 The prototype for this is:
161 typedef memcached_return_t (*memcached_trigger_delete_key)(memcached_st *ptr, char *key, size_t key_length);
166 memcached_callback_get() return the function or structure that was provided.
167 Upon error, nothing is set, null is returned, and the memcached_return_t
168 argument is set to MEMCACHED_FAILURE.
170 memcached_callback_set() returns MEMCACHED_SUCCESS upon successful setting,
171 otherwise MEMCACHED_FAILURE on error.
174 To find out more information please check:
175 \fI\%https://launchpad.net/libmemcached\fP
178 Brian Aker, <\fI\%brian@tangent.org\fP>
181 \fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP
186 .\" Generated by docutils manpage writer.