Update docs.
[awesomized/libmemcached] / docs / man / memcached_callback_set.3
1 .TH "MEMCACHED_CALLBACK_SET" "3" "January 26, 2012" "1.0.4" "libmemcached"
2 .SH NAME
3 memcached_callback_set \- libmemcached Documentation
4 .
5 .nr rst2man-indent-level 0
6 .
7 .de1 rstReportMargin
8 \\$1 \\n[an-margin]
9 level \\n[rst2man-indent-level]
10 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
11 -
12 \\n[rst2man-indent0]
13 \\n[rst2man-indent1]
14 \\n[rst2man-indent2]
15 ..
16 .de1 INDENT
17 .\" .rstReportMargin pre:
18 . RS \\$1
19 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
20 . nr rst2man-indent-level +1
21 .\" .rstReportMargin post:
22 ..
23 .de UNINDENT
24 . RE
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
30 ..
31 .\" Man page generated from reStructeredText.
32 .
33 .sp
34 Get and set a callback
35 .SH SYNOPSIS
36 .sp
37 #include <libmemcached/memcached.h>
38 .INDENT 0.0
39 .TP
40 .B memcached_return_t memcached_callback_set (memcached_st *ptr, memcached_callback_t flag, const void *data);
41 .UNINDENT
42 .INDENT 0.0
43 .TP
44 .B void * memcached_callback_get (memcached_st *ptr, memcached_callback_t flag, memcached_return_t *error);
45 .UNINDENT
46 .sp
47 Compile and link with \-lmemcached
48 .SH DESCRIPTION
49 .sp
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.
53 .sp
54 \fBmemcached_callback_get()\fP takes a callback flag and returns the
55 structure or function set by \fBmemcached_callback_set()\fP.
56 .sp
57 \fBmemcached_callback_set()\fP changes the function/structure assigned by a
58 callback flag. No connections are reset.
59 .sp
60 You can use \fI\%MEMCACHED_CALLBACK_USER_DATA\fP to provide custom context
61 if required for any of the callbacks.
62 .INDENT 0.0
63 .TP
64 .B MEMCACHED_CALLBACK_CLEANUP_FUNCTION
65 .UNINDENT
66 .sp
67 When \fBmemcached_delete()\fP is called this function will be excuted. At
68 the point of its execution all connections are closed.
69 .INDENT 0.0
70 .TP
71 .B MEMCACHED_CALLBACK_CLONE_FUNCTION
72 .UNINDENT
73 .sp
74 When \fBmemcached_delete()\fP is called this function will be excuted.
75 At the point of its execution all connections are closed.
76 .INDENT 0.0
77 .TP
78 .B MEMCACHED_CALLBACK_PREFIX_KEY
79 See \fI\%MEMCACHED_CALLBACK_NAMESPACE\fP
80 .UNINDENT
81 .INDENT 0.0
82 .TP
83 .B MEMCACHED_CALLBACK_NAMESPACE
84 .UNINDENT
85 .sp
86 You can set a value which will be used to create a domain for your keys.
87 The value specified here will be prefixed to each of your keys. The value can
88 not be greater then \fBMEMCACHED_PREFIX_KEY_MAX_SIZE \- 1\fP and will
89 reduce \fBMEMCACHED_MAX_KEY\fP by the value of your key.
90 .sp
91 The prefix key is only applied to the primary key, not the master key.
92 \fBMEMCACHED_FAILURE\fP will be returned if no key is set. In the case of
93 a key which is too long, \fBMEMCACHED_BAD_KEY_PROVIDED\fP will be returned.
94 .sp
95 If you set a value with the value being NULL then the prefix key is disabled.
96 .INDENT 0.0
97 .TP
98 .B MEMCACHED_CALLBACK_USER_DATA
99 .UNINDENT
100 .sp
101 This allows you to store a pointer to a specifc piece of data. This can be
102 retrieved from inside of \fBmemcached_fetch_execute()\fP. Cloning a
103 \fBmemcached_st\fP will copy the pointer to the clone.
104 .INDENT 0.0
105 .TP
106 .B MEMCACHED_CALLBACK_MALLOC_FUNCTION
107 .UNINDENT
108 .sp
109 Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
110 .INDENT 0.0
111 .TP
112 .B MEMCACHED_CALLBACK_REALLOC_FUNCTION
113 .UNINDENT
114 .sp
115 Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
116 .INDENT 0.0
117 .TP
118 .B MEMCACHED_CALLBACK_FREE_FUNCTION
119 .UNINDENT
120 .sp
121 Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
122 .INDENT 0.0
123 .TP
124 .B MEMCACHED_CALLBACK_GET_FAILURE
125 .UNINDENT
126 .sp
127 This function implements the read through cache behavior. On failure of retrieval this callback will be called.
128 .sp
129 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.
130 .sp
131 You must clone the \fBmemcached_st\fP in order to
132 make use of it. The value will be stored only if you return
133 \fBMEMCACHED_SUCCESS\fP or \fBMEMCACHED_BUFFERED\fP. Returning
134 \fBMEMCACHED_BUFFERED\fP will cause the object to be buffered and not sent
135 immediatly (if this is the default behavior based on your connection setup
136 this will happen automatically).
137 .sp
138 The prototype for this is:
139 .INDENT 0.0
140 .TP
141 .B memcached_return_t (*memcached_trigger_key)(memcached_st *ptr, char *key, size_t key_length, memcached_result_st *result);
142 .UNINDENT
143 .INDENT 0.0
144 .TP
145 .B MEMCACHED_CALLBACK_DELETE_TRIGGER
146 .UNINDENT
147 .sp
148 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.
149 .sp
150 The prototype for this is:
151 .INDENT 0.0
152 .TP
153 .B typedef memcached_return_t (*memcached_trigger_delete_key)(memcached_st *ptr, char *key, size_t key_length);
154 .UNINDENT
155 .SH RETURN
156 .sp
157 \fBmemcached_callback_get()\fP return the function or structure that was
158 provided. Upon error, nothing is set, null is returned, and the
159 \fBmemcached_return_t\fP argument is set to \fBMEMCACHED_FAILURE\fP.
160 .sp
161 \fBmemcached_callback_set()\fP returns \fBMEMCACHED_SUCCESS\fP upon
162 successful setting, otherwise \fBMEMCACHED_FAILURE\fP on error.
163 .SH HOME
164 .sp
165 To find out more information please check:
166 \fI\%http://libmemcached.org/\fP
167 .SH AUTHOR
168 .sp
169 Brian Aker, <\fI\%brian@tangent.org\fP>
170 .SH SEE ALSO
171 .sp
172 \fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP
173 .SH AUTHOR
174 Brian Aker
175 .SH COPYRIGHT
176 2011, Brian Aker DataDifferential, http://datadifferential.com/
177 .\" Generated by docutils manpage writer.
178 .\"
179 .