c6007b4324e2328f5a311c54df464b85ebf81ae2
[awesomized/libmemcached] / docs / man / memcached_result_cas.3
1 .TH "MEMCACHED_RESULT_CAS" "3" "September 16, 2012" "1.0.10" "libmemcached"
2 .SH NAME
3 memcached_result_cas \- Working with result sets
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 .SH SYNOPSIS
34 .sp
35 #include <libmemcached/memcached_pool.h>
36 .INDENT 0.0
37 .TP
38 .B memcached_result_st
39 .UNINDENT
40 .INDENT 0.0
41 .TP
42 .B \fI\%memcached_result_st\fP * memcached_result_create(memcached_st\fI\ *ptr\fP, \fI\%memcached_result_st\fP\fI\ *result\fP)
43 .UNINDENT
44 .INDENT 0.0
45 .TP
46 .B void memcached_result_free(\fI\%memcached_result_st\fP\fI\ *result\fP)
47 .UNINDENT
48 .INDENT 0.0
49 .TP
50 .B const char * memcached_result_key_value(\fI\%memcached_result_st\fP\fI\ *result\fP)
51 .UNINDENT
52 .INDENT 0.0
53 .TP
54 .B size_t memcached_result_key_length(const \fI\%memcached_result_st\fP\fI\ *result\fP)
55 .UNINDENT
56 .INDENT 0.0
57 .TP
58 .B const char *memcached_result_value(\fI\%memcached_result_st\fP\fI\ *ptr\fP)
59 .UNINDENT
60 .INDENT 0.0
61 .TP
62 .B size_t memcached_result_length(const \fI\%memcached_result_st\fP\fI\ *ptr\fP)
63 .UNINDENT
64 .INDENT 0.0
65 .TP
66 .B uint32_t memcached_result_flags(const \fI\%memcached_result_st\fP\fI\ *result\fP)
67 .UNINDENT
68 .INDENT 0.0
69 .TP
70 .B uint64_t memcached_result_cas(const \fI\%memcached_result_st\fP\fI\ *result\fP)
71 .UNINDENT
72 .INDENT 0.0
73 .TP
74 .B memcached_return_t memcached_result_set_value(\fI\%memcached_result_st\fP\fI\ *ptr\fP, const char\fI\ *value\fP, size_t\fI\ length\fP)
75 .UNINDENT
76 .INDENT 0.0
77 .TP
78 .B void memcached_result_set_flags(\fI\%memcached_result_st\fP\fI\ *ptr\fP, uint32_t\fI\ flags\fP)
79 .UNINDENT
80 .INDENT 0.0
81 .TP
82 .B void memcached_result_set_expiration(\fI\%memcached_result_st\fP\fI\ *ptr\fP, time_t)
83 .UNINDENT
84 .sp
85 Compile and link with \-lmemcachedutil \-lmemcached
86 .SH DESCRIPTION
87 .sp
88 libmemcached(3) can optionally return a \fI\%memcached_result_st\fP which
89 acts as a result object. The result objects have added benefits over the
90 character pointer returns, in that they are forward compatible with new
91 return items that future memcached servers may implement (the best current
92 example of this is the CAS return item). The structures can also be reused,
93 which will save on calls to malloc(3). It is suggested that you use result
94 objects over char * return functions.
95 .sp
96 The structure of \fI\%memcached_result_st\fP has been encapsulated, you should
97 not write code to directly access members of the structure.
98 .sp
99 \fI\%memcached_result_create()\fP will either allocate memory for a
100 \fI\%memcached_result_st\fP or will initialize a structure passed to it.
101 .sp
102 \fI\%memcached_result_free()\fP will deallocate any memory attached to the
103 structure. If the structure was also allocated, it will deallocate it.
104 .sp
105 \fI\%memcached_result_key_value()\fP returns the key value associated with the
106 current result object.
107 .sp
108 \fI\%memcached_result_key_length()\fP returns the key length associated with
109 the current result object.
110 .sp
111 \fI\%memcached_result_value()\fP returns the result value associated with the
112 current result object.
113 .sp
114 \fI\%memcached_result_length()\fP returns the result length associated with
115 the current result object.
116 .sp
117 \fI\%memcached_result_flags()\fP returns the flags associated with the
118 current result object.
119 .sp
120 \fI\%memcached_result_cas()\fP returns the cas associated with the
121 current result object. This value will only be available if the server
122 tests it.
123 .sp
124 \fI\%memcached_result_set_value()\fP takes a byte array and a size and sets
125 the result to this value. This function is used for trigger responses.
126 .sp
127 \fI\%memcached_result_set_flags()\fP takes a result structure and stores a new
128 value for the flags field.
129 .sp
130 \fI\%memcached_result_set_expiration()\fP takes a result structure and stores
131 a new value for the expiration field (this is only used by read through
132 triggers).
133 .sp
134 You may wish to avoid using memcached_result_create(3) with a
135 stack based allocation. The most common issues related to ABI safety involve
136 heap allocated structures.
137 .SH RETURN
138 .sp
139 Varies, see particular functions. All structures must have
140 \fI\%memcached_result_free()\fP called on them for cleanup purposes. Failure
141 to do this will result in leaked memory.
142 .SH HOME
143 .sp
144 To find out more information please check:
145 \fI\%http://libmemcached.org/\fP
146 .SH SEE ALSO
147 .sp
148 \fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP
149 .SH AUTHOR
150 Brian Aker
151 .SH COPYRIGHT
152 2011-2012, Brian Aker DataDifferential, http://datadifferential.com/
153 .\" Generated by docutils manpage writer.
154 .\"
155 .