Merge pull request #140 from hussainnaqvee/patch-1
[awesomized/libmemcached] / source / 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. memcached_increment_with_initial is only available
57 when using the binary protocol.
58
59 memcached_decrement_with_initial takes a key and keylength and decrements
60 the value by the offset passed to it. If the object specified by key does
61 not exist, one of two things may happen: If the expiration value is
62 MEMCACHED_EXPIRATION_NOT_ADD, the operation will fail. For all other
63 expiration values, the operation will succeed by seeding the value for that
64 key with a initial value to expire with the provided expiration time. The
65 flags will be set to zero.The value is then returned via the uint32_t
66 value pointer you pass to it. memcached_decrement_with_initial is only available
67 when using the binary protocol.
68
69 :c:func:`memcached_increment_by_key`, :c:func:`memcached_decrement_by_key`,
70 :c:func:`memcached_increment_with_initial_by_key`, and
71 :c:func:`memcached_decrement_with_initial_by_key` are master key equivalents of the above.
72
73
74 ------
75 RETURN
76 ------
77
78
79 A value of type :c:type:`memcached_return_t` is returned.
80 On success that value will be :c:type:`MEMCACHED_SUCCESS`.
81 Use memcached_strerror to translate this value to a printable string.
82
83
84 ----
85 HOME
86 ----
87
88
89 To find out more information please check:
90 `http://libmemcached.org/ <http://libmemcached.org/>`_
91
92
93 --------
94 SEE ALSO
95 --------
96
97
98 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`