1 =========================================================
2 Incrementing and Decrementing values stored in the server
3 =========================================================
14 C Client Library for memcached (libmemcached, -lmemcached)
25 #include <libmemcached/memcached.h>
28 memcached_increment (memcached_st *ptr,
29 const char *key, size_t key_length,
34 memcached_decrement (memcached_st *ptr,
35 const char *key, size_t key_length,
40 memcached_increment_with_initial (memcached_st *ptr,
49 memcached_decrement_with_initial (memcached_st *ptr,
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,
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,
72 memcached_increment_with_initial_by_key (memcached_st *ptr,
73 const char *master_key,
74 size_t master_key_length,
83 memcached_decrement_with_initial_by_key (memcached_st *ptr,
84 const char *master_key,
85 size_t master_key_length,
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.
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.
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.
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.
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.
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
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.
151 To find out more information please check:
152 `https://launchpad.net/libmemcached <https://launchpad.net/libmemcached>`_
160 Brian Aker, <brian@tangent.org>
168 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`