~brianaker/libmemcached/gear-clean

« back to all changes in this revision

Viewing changes to docs/man/memcached_callback_set.3

  • Committer: Brian Aker
  • Date: 2012-09-24 01:36:01 UTC
  • mto: This revision was merged to the branch mainline in revision 1072.
  • Revision ID: brian@tangent.org-20120924013601-4f0zeykol10ka6so
Updates from ddm4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.TH "MEMCACHED_CALLBACK_SET" "3" "September 16, 2012" "1.0.10" "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_callback_t
 
41
.UNINDENT
 
42
.INDENT 0.0
 
43
.TP
 
44
.B memcached_return_t memcached_callback_set(memcached_st\fI\ *ptr\fP, \fI\%memcached_callback_t\fP\fI\ flag\fP, const void\fI\ *data\fP)
 
45
.UNINDENT
 
46
.INDENT 0.0
 
47
.TP
 
48
.B void * memcached_callback_get(memcached_st\fI\ *ptr\fP, \fI\%memcached_callback_t\fP\fI\ flag\fP, memcached_return_t\fI\ *error\fP)
 
49
.UNINDENT
 
50
.sp
 
51
Compile and link with \-lmemcached
 
52
.SH DESCRIPTION
 
53
.sp
 
54
libmemcached(3) can have callbacks set key execution points. These either
 
55
provide function calls at points in the code, or return pointers to
 
56
structures for particular usages.
 
57
.sp
 
58
\fI\%memcached_callback_get()\fP takes a callback flag and returns the
 
59
structure or function set by \fI\%memcached_callback_set()\fP.
 
60
.sp
 
61
\fI\%memcached_callback_set()\fP changes the function/structure assigned by a
 
62
callback flag. No connections are reset.
 
63
.sp
 
64
You can use \fI\%MEMCACHED_CALLBACK_USER_DATA\fP to provide custom context
 
65
if required for any of the callbacks.
 
66
.INDENT 0.0
 
67
.TP
 
68
.B MEMCACHED_CALLBACK_CLEANUP_FUNCTION
 
69
.UNINDENT
 
70
.sp
 
71
When \fBmemcached_delete()\fP is called this function will be excuted. At
 
72
the point of its execution all connections are closed.
 
73
.INDENT 0.0
 
74
.TP
 
75
.B MEMCACHED_CALLBACK_CLONE_FUNCTION
 
76
.UNINDENT
 
77
.sp
 
78
When \fBmemcached_delete()\fP is called this function will be excuted.
 
79
At the point of its execution all connections are closed.
 
80
.INDENT 0.0
 
81
.TP
 
82
.B MEMCACHED_CALLBACK_PREFIX_KEY
 
83
See \fI\%MEMCACHED_CALLBACK_NAMESPACE\fP
 
84
.UNINDENT
 
85
.INDENT 0.0
 
86
.TP
 
87
.B MEMCACHED_CALLBACK_NAMESPACE
 
88
.UNINDENT
 
89
.sp
 
90
You can set a value which will be used to create a domain for your keys.
 
91
The value specified here will be prefixed to each of your keys. The value can
 
92
not be greater then \fBMEMCACHED_PREFIX_KEY_MAX_SIZE\fP \- 1 and will
 
93
reduce \fBMEMCACHED_MAX_KEY\fP by the value of your key.
 
94
.sp
 
95
The prefix key is only applied to the primary key, not the master key.
 
96
\fBMEMCACHED_FAILURE\fP will be returned if no key is set. In the case of
 
97
a key which is too long, \fBMEMCACHED_BAD_KEY_PROVIDED\fP will be returned.
 
98
.sp
 
99
If you set a value with the value being NULL then the prefix key is disabled.
 
100
.INDENT 0.0
 
101
.TP
 
102
.B MEMCACHED_CALLBACK_USER_DATA
 
103
.UNINDENT
 
104
.sp
 
105
This allows you to store a pointer to a specifc piece of data. This can be
 
106
retrieved from inside of \fBmemcached_fetch_execute()\fP. Cloning a
 
107
\fBmemcached_st\fP will copy the pointer to the clone.
 
108
.INDENT 0.0
 
109
.TP
 
110
.B MEMCACHED_CALLBACK_MALLOC_FUNCTION
 
111
.UNINDENT
 
112
.sp
 
113
Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
 
114
.INDENT 0.0
 
115
.TP
 
116
.B MEMCACHED_CALLBACK_REALLOC_FUNCTION
 
117
.UNINDENT
 
118
.sp
 
119
Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
 
120
.INDENT 0.0
 
121
.TP
 
122
.B MEMCACHED_CALLBACK_FREE_FUNCTION
 
123
.UNINDENT
 
124
.sp
 
125
Deprecated since version <0.32: Use \fBmemcached_set_memory_allocators\fP instead.
 
126
.INDENT 0.0
 
127
.TP
 
128
.B MEMCACHED_CALLBACK_GET_FAILURE
 
129
.UNINDENT
 
130
.sp
 
131
This function implements the read through cache behavior. On failure of retrieval this callback will be called.
 
132
.sp
 
133
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.
 
134
.sp
 
135
You must clone the \fBmemcached_st\fP in order to
 
136
make use of it. The value will be stored only if you return
 
137
\fBMEMCACHED_SUCCESS\fP or \fBMEMCACHED_BUFFERED\fP. Returning
 
138
\fBMEMCACHED_BUFFERED\fP will cause the object to be buffered and not sent
 
139
immediatly (if this is the default behavior based on your connection setup
 
140
this will happen automatically).
 
141
.sp
 
142
The prototype for this is:
 
143
.INDENT 0.0
 
144
.TP
 
145
.B memcached_return_t (*memcached_trigger_key)(memcached_st *ptr, char *key, size_t key_length, memcached_result_st *result);
 
146
.UNINDENT
 
147
.INDENT 0.0
 
148
.TP
 
149
.B MEMCACHED_CALLBACK_DELETE_TRIGGER
 
150
.UNINDENT
 
151
.sp
 
152
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.
 
153
.sp
 
154
The prototype for this is:
 
155
.INDENT 0.0
 
156
.TP
 
157
.B typedef memcached_return_t (*memcached_trigger_delete_key)(memcached_st *ptr, char *key, size_t key_length);
 
158
.UNINDENT
 
159
.SH RETURN
 
160
.sp
 
161
\fI\%memcached_callback_get()\fP return the function or structure that was
 
162
provided. Upon error, nothing is set, null is returned, and the
 
163
\fBmemcached_return_t\fP argument is set to \fBMEMCACHED_FAILURE\fP.
 
164
.sp
 
165
\fI\%memcached_callback_set()\fP returns \fBMEMCACHED_SUCCESS\fP upon
 
166
successful setting, otherwise \fBMEMCACHED_FAILURE\fP on error.
 
167
.SH HOME
 
168
.sp
 
169
To find out more information please check:
 
170
\fI\%http://libmemcached.org/\fP
 
171
.SH AUTHOR
 
172
.sp
 
173
Brian Aker, <\fI\%brian@tangent.org\fP>
 
174
.SH SEE ALSO
 
175
.sp
 
176
\fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP
 
177
.SH AUTHOR
 
178
Brian Aker
 
179
.SH COPYRIGHT
 
180
2011-2012, Brian Aker DataDifferential, http://datadifferential.com/
 
181
.\" Generated by docutils manpage writer.
 
182
.\" 
 
183
.