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