Merge in documentation updates.
[m6w6/libmemcached] / docs / memcached_auto.rst
1 =========================================================
2 Incrementing and Decrementing values stored in the server
3 =========================================================
4
5
6 Manipulate counters
7
8
9 *******
10 LIBRARY
11 *******
12
13
14 C Client Library for memcached (libmemcached, -lmemcached)
15
16
17 --------
18 SYNOPSIS
19 --------
20
21
22
23 .. code-block:: perl
24
25 #include <libmemcached/memcached.h>
26
27 memcached_return_t
28 memcached_increment (memcached_st *ptr,
29 const char *key, size_t key_length,
30 unsigned int offset,
31 uint64_t *value);
32
33 memcached_return_t
34 memcached_decrement (memcached_st *ptr,
35 const char *key, size_t key_length,
36 unsigned int offset,
37 uint64_t *value);
38
39 memcached_return_t
40 memcached_increment_with_initial (memcached_st *ptr,
41 const char *key,
42 size_t key_length,
43 uint64_t offset,
44 uint64_t initial,
45 time_t expiration,
46 uint64_t *value);
47
48 memcached_return_t
49 memcached_decrement_with_initial (memcached_st *ptr,
50 const char *key,
51 size_t key_length,
52 uint64_t offset,
53 uint64_t initial,
54 time_t expiration,
55 uint64_t *value);
56
57 memcached_return_t
58 memcached_increment_by_key (memcached_st *ptr,
59 const char *master_key, size_t master_key_length,
60 const char *key, size_t key_length,
61 unsigned int offset,
62 uint64_t *value);
63
64 memcached_return_t
65 memcached_decrement_by_key (memcached_st *ptr,
66 const char *master_key, size_t master_key_length,
67 const char *key, size_t key_length,
68 unsigned int offset,
69 uint64_t *value);
70
71 memcached_return_t
72 memcached_increment_with_initial_by_key (memcached_st *ptr,
73 const char *master_key,
74 size_t master_key_length,
75 const char *key,
76 size_t key_length,
77 uint64_t offset,
78 uint64_t initial,
79 time_t expiration,
80 uint64_t *value);
81
82 memcached_return_t
83 memcached_decrement_with_initial_by_key (memcached_st *ptr,
84 const char *master_key,
85 size_t master_key_length,
86 const char *key,
87 size_t key_length,
88 uint64_t offset,
89 uint64_t initial,
90 time_t expiration,
91 uint64_t *value);
92
93
94
95 -----------
96 DESCRIPTION
97 -----------
98
99
100 memcached(1) servers have the ability to increment and decrement keys
101 (overflow and underflow are not detected). This gives you the ability to use
102 memcached to generate shared sequences of values.
103
104 memcached_increment() takes a key and keylength and increments the value by
105 the offset passed to it. The value is then returned via the unsigned int
106 value pointer you pass to it.
107
108 memcached_decrement() takes a key and keylength and decrements the value by
109 the offset passed to it. The value is then returned via the unsigned int
110 value pointer you pass to it.
111
112 memcached_increment_with_initial() takes a key and keylength and increments
113 the value by the offset passed to it. If the object specified by key does
114 not exist, one of two things may happen: If the expiration value is
115 MEMCACHED_EXPIRATION_NOT_ADD, the operation will fail. For all other
116 expiration values, the operation will succeed by seeding the value for that
117 key with a initial value to expire with the provided expiration time. The
118 flags will be set to zero.The value is then returned via the unsigned int
119 value pointer you pass to it.
120
121 memcached_decrement_with_initial() takes a key and keylength and decrements
122 the value by the offset passed to it. If the object specified by key does
123 not exist, one of two things may happen: If the expiration value is
124 MEMCACHED_EXPIRATION_NOT_ADD, the operation will fail. For all other
125 expiration values, the operation will succeed by seeding the value for that
126 key with a initial value to expire with the provided expiration time. The
127 flags will be set to zero.The value is then returned via the unsigned int
128 value pointer you pass to it.
129
130 memcached_increment_by_key(), memcached_decrement_by_key(),
131 memcached_increment_with_initial_by_key(), and
132 memcached_decrement_with_initial_by_key() are master key equivalents of the
133 above.
134
135
136 ******
137 RETURN
138 ******
139
140
141 A value of type \ ``memcached_return_t``\ is returned.
142 On success that value will be \ ``MEMCACHED_SUCCESS``\ .
143 Use memcached_strerror() to translate this value to a printable string.
144
145
146 ****
147 HOME
148 ****
149
150
151 To find out more information please check:
152 `https://launchpad.net/libmemcached <https://launchpad.net/libmemcached>`_
153
154
155 ******
156 AUTHOR
157 ******
158
159
160 Brian Aker, <brian@tangent.org>
161
162
163 --------
164 SEE ALSO
165 --------
166
167
168 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`