docs: sanitize
[awesomized/libmemcached] / docs / source / libmemcached / memcached_auto.rst
1 Incrementing and Decrementing Values
2 ====================================
3
4 .. index:: object: memcached_st
5
6 SYNOPSIS
7 --------
8
9 #include <libmemcached/memcached.h>
10
11 .. function:: memcached_return_t memcached_increment (memcached_st *ptr, const char *key, size_t key_length, uint32_t offset, uint64_t *value)
12
13 .. function:: memcached_return_t memcached_decrement (memcached_st *ptr, const char *key, size_t key_length, uint32_t offset, uint64_t *value)
14
15 .. function:: memcached_return_t memcached_increment_with_initial (memcached_st *ptr, const char *key, size_t key_length, uint64_t offset, uint64_t initial, time_t expiration, uint64_t *value)
16
17 .. function:: memcached_return_t memcached_decrement_with_initial (memcached_st *ptr, const char *key, size_t key_length, uint64_t offset, uint64_t initial, time_t expiration, uint64_t *value)
18
19 .. function:: memcached_return_t memcached_increment_by_key (memcached_st *ptr, const char *group_key, size_t group_key_length, const char *key, size_t key_length, uint32_t offset, uint64_t *value)
20
21 .. function:: memcached_return_t memcached_decrement_by_key (memcached_st *ptr, const char *group_key, size_t group_key_length, const char *key, size_t key_length, uint32_t offset, uint64_t *value)
22
23 .. function:: memcached_return_t memcached_increment_with_initial_by_key (memcached_st *ptr, const char *group_key, size_t group_key_length, const char *key, size_t key_length, uint64_t offset, uint64_t initial, time_t expiration, uint64_t *value)
24
25 .. function:: memcached_return_t memcached_decrement_with_initial_by_key (memcached_st *ptr, const char *group_key, size_t group_key_length, const char *key, size_t key_length, uint64_t offset, uint64_t initial, time_t expiration, uint64_t *value)
26
27 Compile and link with -lmemcached
28
29 DESCRIPTION
30 -----------
31
32 :manpage:`memcached(1)` servers have the ability to increment and decrement keys
33 (overflow and underflow are not detected). This gives you the ability to use
34 memcached to generate shared sequences of values.
35
36 memcached_increment takes a key and key length and increments the value by
37 the offset passed to it. The value is then returned via the uint32_t
38 value pointer you pass to it.
39
40 memcached_decrement takes a key and keylength and decrements the value by
41 the offset passed to it. The value is then returned via the uint32_t
42 value pointer you pass to it.
43
44 memcached_increment_with_initial takes a key and keylength and increments
45 the value by the offset passed to it. If the object specified by key does
46 not exist, one of two things may happen: If the expiration value is
47 MEMCACHED_EXPIRATION_NOT_ADD, the operation will fail. For all other
48 expiration values, the operation will succeed by seeding the value for that
49 key with a initial value to expire with the provided expiration time. The
50 flags will be set to zero.The value is then returned via the uint32_t
51 value pointer you pass to it. memcached_increment_with_initial is only available
52 when using the binary protocol.
53
54 memcached_decrement_with_initial takes a key and keylength and decrements
55 the value by the offset passed to it. If the object specified by key does
56 not exist, one of two things may happen: If the expiration value is
57 MEMCACHED_EXPIRATION_NOT_ADD, the operation will fail. For all other
58 expiration values, the operation will succeed by seeding the value for that
59 key with a initial value to expire with the provided expiration time. The
60 flags will be set to zero.The value is then returned via the uint32_t
61 value pointer you pass to it. memcached_decrement_with_initial is only available
62 when using the binary protocol.
63
64 :func:`memcached_increment_by_key`, :func:`memcached_decrement_by_key`,
65 :func:`memcached_increment_with_initial_by_key`, and
66 :func:`memcached_decrement_with_initial_by_key` are master key equivalents of the above.
67
68 RETURN
69 ------
70
71 A value of type :type:`memcached_return_t` is returned.
72 On success that value will be `MEMCACHED_SUCCESS`.
73 Use memcached_strerror to translate this value to a printable string.
74
75 SEE ALSO
76 --------
77
78 .. only:: man
79
80 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`