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