1memcached_increment.pop(3) memcached_increment memcached_increment.pop(3)
2
3
4
6 memcached_increment, memcached_decrement,
7 memcached_increment_with_initial, memcached_decrement_with_initial -
8 Manipulate counters
9
11 C Client Library for memcached (libmemcached, -lmemcached)
12
14 #include <memcached.h>
15
16 memcached_return_t
17 memcached_increment (memcached_st *ptr,
18 const char *key, size_t key_length,
19 unsigned int offset,
20 uint64_t *value);
21
22 memcached_return_t
23 memcached_decrement (memcached_st *ptr,
24 const char *key, size_t key_length,
25 unsigned int offset,
26 uint64_t *value);
27
28 memcached_return_t
29 memcached_increment_with_initial (memcached_st *ptr,
30 const char *key,
31 size_t key_length,
32 uint64_t offset,
33 uint64_t initial,
34 time_t expiration,
35 uint64_t *value);
36
37 memcached_return_t
38 memcached_decrement_with_initial (memcached_st *ptr,
39 const char *key,
40 size_t key_length,
41 uint64_t offset,
42 uint64_t initial,
43 time_t expiration,
44 uint64_t *value);
45
46 memcached_return_t
47 memcached_increment_by_key (memcached_st *ptr,
48 const char *master_key, size_t master_key_length,
49 const char *key, size_t key_length,
50 unsigned int offset,
51 uint64_t *value);
52
53 memcached_return_t
54 memcached_decrement_by_key (memcached_st *ptr,
55 const char *master_key, size_t master_key_length,
56 const char *key, size_t key_length,
57 unsigned int offset,
58 uint64_t *value);
59
60 memcached_return_t
61 memcached_increment_with_initial_by_key (memcached_st *ptr,
62 const char *master_key,
63 size_t master_key_length,
64 const char *key,
65 size_t key_length,
66 uint64_t offset,
67 uint64_t initial,
68 time_t expiration,
69 uint64_t *value);
70
71 memcached_return_t
72 memcached_decrement_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
83 memcached(1) servers have the ability to increment and decrement keys
84 (overflow and underflow are not detected). This gives you the ability
85 to use memcached to generate shared sequences of values.
86
87 memcached_increment() takes a key and keylength and increments the
88 value by the offset passed to it. The value is then returned via the
89 unsigned int value pointer you pass to it.
90
91 memcached_decrement() takes a key and keylength and decrements the
92 value by the offset passed to it. The value is then returned via the
93 unsigned int value pointer you pass to it.
94
95 memcached_increment_with_initial() takes a key and keylength and
96 increments the value by the offset passed to it. If the object
97 specified by key does not exist, one of two things may happen: If the
98 expiration value is MEMCACHED_EXPIRATION_NOT_ADD, the operation will
99 fail. For all other expiration values, the operation will succeed by
100 seeding the value for that key with a initial value to expire with the
101 provided expiration time. The flags will be set to zero.The value is
102 then returned via the unsigned int value pointer you pass to it.
103
104 memcached_decrement_with_initial() takes a key and keylength and
105 decrements the value by the offset passed to it. If the object
106 specified by key does not exist, one of two things may happen: If the
107 expiration value is MEMCACHED_EXPIRATION_NOT_ADD, the operation will
108 fail. For all other expiration values, the operation will succeed by
109 seeding the value for that key with a initial value to expire with the
110 provided expiration time. The flags will be set to zero.The value is
111 then returned via the unsigned int value pointer you pass to it.
112
113 memcached_increment_by_key(), memcached_decrement_by_key(),
114 memcached_increment_with_initial_by_key(), and
115 memcached_decrement_with_initial_by_key() are master key equivalents of
116 the above.
117
119 A value of type "memcached_return_t" is returned. On success that
120 value will be "MEMCACHED_SUCCESS". Use memcached_strerror() to
121 translate this value to a printable string.
122
124 To find out more information please check:
125 <https://launchpad.net/libmemcached>
126
128 Brian Aker, <brian@tangent.org>
129
131 memcached(1) libmemcached(3) memcached_strerror(3)
132
133
134
135 2010-06-28 memcached_increment.pop(3)