1 .TH "MEMCACHED_CALLBACK_SET" "3" "October 24, 2011" "1.01" "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 #include <libmemcached/memcached.h>
40 .B memcached_return_t memcached_callback_set (memcached_st *ptr, memcached_callback_t flag, const void *data);
44 .B void * memcached_callback_get (memcached_st *ptr, memcached_callback_t flag, memcached_return_t *error);
47 Compile and link with \-lmemcached
50 libmemcached(3) can have callbacks set key execution points. These either
51 provide function calls at points in the code, or return pointers to
52 structures for particular usages.
54 \fBmemcached_callback_get()\fP takes a callback flag and returns the
55 structure or function set by \fBmemcached_callback_set()\fP.
57 \fBmemcached_callback_set()\fP changes the function/structure assigned by a
58 callback flag. No connections are reset.
60 You can use \fI\%MEMCACHED_CALLBACK_USER_DATA\fP to provide custom context
61 if required for any of the callbacks.
64 .B MEMCACHED_CALLBACK_CLEANUP_FUNCTION
67 When \fBmemcached_delete()\fP is called this function will be excuted. At
68 the point of its execution all connections are closed.
71 .B MEMCACHED_CALLBACK_CLONE_FUNCTION
74 When \fBmemcached_delete()\fP is called this function will be excuted.
75 At the point of its execution all connections are closed.
78 .B MEMCACHED_CALLBACK_PREFIX_KEY
80 See \fI\%MEMCACHED_CALLBACK_NAMESPACE\fP
84 .B MEMCACHED_CALLBACK_NAMESPACE
87 You can set a value which will be used to create a domain for your keys.
88 The value specified here will be prefixed to each of your keys. The value can
89 not be greater then \fBMEMCACHED_PREFIX_KEY_MAX_SIZE \- 1\fP and will
90 reduce \fBMEMCACHED_MAX_KEY\fP by the value of your key.
92 The prefix key is only applied to the primary key, not the master key.
93 \fBMEMCACHED_FAILURE\fP will be returned if no key is set. In the case of
94 a key which is too long, \fBMEMCACHED_BAD_KEY_PROVIDED\fP will be returned.
96 If you set a value with the value being NULL then the prefix key is disabled.
99 .B MEMCACHED_CALLBACK_USER_DATA
102 This allows you to store a pointer to a specifc piece of data. This can be
103 retrieved from inside of \fBmemcached_fetch_execute()\fP. Cloning a
104 \fBmemcached_st\fP will copy the pointer to the clone.
107 .B MEMCACHED_CALLBACK_MALLOC_FUNCTION
110 Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
113 .B MEMCACHED_CALLBACK_REALLOC_FUNCTION
116 Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
119 .B MEMCACHED_CALLBACK_FREE_FUNCTION
122 Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
125 .B MEMCACHED_CALLBACK_GET_FAILURE
128 This function implements the read through cache behavior. On failure of retrieval this callback will be called.
130 You are responsible for populating the result object provided. This result object will then be stored in the server and returned to the calling process.
132 You must clone the \fBmemcached_st\fP in order to
133 make use of it. The value will be stored only if you return
134 \fBMEMCACHED_SUCCESS\fP or \fBMEMCACHED_BUFFERED\fP. Returning
135 \fBMEMCACHED_BUFFERED\fP will cause the object to be buffered and not sent
136 immediatly (if this is the default behavior based on your connection setup
137 this will happen automatically).
139 The prototype for this is:
142 .B memcached_return_t (*memcached_trigger_key)(memcached_st *ptr, char *key, size_t key_length, memcached_result_st *result);
146 .B MEMCACHED_CALLBACK_DELETE_TRIGGER
149 This function implements a trigger upon successful deletion of a key. The memcached_st structure will need to be cloned in order to make use of it.
151 The prototype for this is:
154 .B typedef memcached_return_t (*memcached_trigger_delete_key)(memcached_st *ptr, char *key, size_t key_length);
158 \fBmemcached_callback_get()\fP return the function or structure that was
159 provided. Upon error, nothing is set, null is returned, and the
160 \fBmemcached_return_t\fP argument is set to \fBMEMCACHED_FAILURE\fP.
162 \fBmemcached_callback_set()\fP returns \fBMEMCACHED_SUCCESS\fP upon
163 successful setting, otherwise \fBMEMCACHED_FAILURE\fP on error.
166 To find out more information please check:
167 \fI\%http://libmemcached.org/\fP
170 Brian Aker, <\fI\%brian@tangent.org\fP>
173 \fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP
177 2011, Brian Aker DataDifferential, http://datadifferential.com/
178 .\" Generated by docutils manpage writer.