Merged trunk.
[awesomized/libmemcached] / docs / memcached_result_st.rst
1 .. highlight:: perl
2
3
4 ****
5 NAME
6 ****
7
8
9 memcached_result_create, memcached_result_free,
10 memcached_result_key_value, memcached_result_key_length,
11 memcached_result_value, memcached_result_length,
12 memcached_result_flags, memcached_result_cas - Work with memcached_result_st
13
14
15 *******
16 LIBRARY
17 *******
18
19
20 C Client Library for memcached (libmemcached, -lmemcached)
21
22
23 ********
24 SYNOPSIS
25 ********
26
27
28
29 .. code-block:: perl
30
31 #include <memcached.h>
32
33 memcached_result_st *
34 memcached_result_create (memcached_st *ptr,
35 memcached_result_st *result);
36
37 void memcached_result_free (memcached_result_st *result);
38
39 const char * memcached_result_key_value (memcached_result_st *result);
40
41 size_t memcached_result_key_length (const memcached_result_st *result);
42
43 const char *memcached_result_value (memcached_result_st *ptr);
44
45 size_t memcached_result_length (const memcached_result_st *ptr);
46
47 uint32_t memcached_result_flags (const memcached_result_st *result)
48
49 uint64_t memcached_result_cas (const memcached_result_st *result);
50
51 memcached_return_t
52 memcached_result_set_value (memcached_result_st *ptr,
53 const char *value, size_t length)
54
55 void memcached_result_set_flags (memcached_result_st *ptr, uint32_t flags)
56
57 void memcached_result_set_expiration (memcached_result_st *ptr, time_t)
58
59
60
61 ***********
62 DESCRIPTION
63 ***********
64
65
66 libmemcached(3) can optionally return a memcached_result_st which acts as a
67 result object. The result objects have added benefits over the character
68 pointer returns in that they are forward compatible with new return items
69 that future memcached servers may implement (the best current example of
70 this is the CAS return item). The structures can also be reused which will
71 save on calls to malloc(3). It is suggested that you use result objects over
72 char \* return functions.
73
74 The structure of memcached_result_st has been encapsulated, you should not
75 write code to directly access members of the structure.
76
77 memcached_result_create() will either allocate memory for a
78 memcached_result_st or will initialize a structure passed to it.
79
80 memcached_result_free() will deallocate any memory attached to the
81 structure. If the structure was also alloacted, it will deallocate it.
82
83 memcached_result_key_value() returns the key value associated with the
84 current result object.
85
86 memcached_result_key_length() returns the key length associated with the
87 current result object.
88
89 memcached_result_value() returns the result value associated with the
90 current result object.
91
92 memcached_result_length() returns the result length associated with the
93 current result object.
94
95 memcached_result_flags() returns the flags associated with the
96 current result object.
97
98 memcached_result_cas() returns the cas associated with the
99 current result object. This value will only be available if the server
100 supports it.
101
102 memcached_result_set_value() takes a byte array and a size and sets
103 the result to this value. This function is used for trigger responses.
104
105 void memcached_result_set_flags() takes a result structure and stores
106 a new value for the flags field.
107
108 void memcached_result_set_expiration(A) takes a result structure and stores
109 a new value for the expiration field (this is only used by read through
110 triggers).
111
112 You may wish to avoid using memcached_result_create(3) with a
113 stack based allocation. The most common issues related to ABI safety involve
114 heap allocated structures.
115
116
117 ******
118 RETURN
119 ******
120
121
122 Varies, see particular functions. All structures must have
123 memcached_result_free() called on them for cleanup purposes. Failure to
124 do this will result in leaked memory.
125
126
127 ****
128 HOME
129 ****
130
131
132 To find out more information please check:
133 `https://launchpad.net/libmemcached <https://launchpad.net/libmemcached>`_
134
135
136 ******
137 AUTHOR
138 ******
139
140
141 Brian Aker, <brian@tangent.org>
142
143
144 ********
145 SEE ALSO
146 ********
147
148
149 memcached(1) libmemcached(3) memcached_strerror(3)
150