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