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