Style cleanup
[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, unsigned int offset, uint64_t *value);
14
15 .. c:function:: memcached_return_t memcached_decrement (memcached_st *ptr, const char *key, size_t key_length, unsigned int 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, unsigned int 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, unsigned int 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 unsigned int
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 unsigned int
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 unsigned int
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 unsigned int
65 value pointer you pass to it.
66
67 memcached_increment_by_key(), memcached_decrement_by_key(),
68 memcached_increment_with_initial_by_key(), and
69 memcached_decrement_with_initial_by_key() are master key equivalents of the
70 above.
71
72
73 ------
74 RETURN
75 ------
76
77
78 A value of type \ ``memcached_return_t``\ is returned.
79 On success that value will be \ ``MEMCACHED_SUCCESS``\ .
80 Use memcached_strerror() to translate this value to a printable string.
81
82
83 ----
84 HOME
85 ----
86
87
88 To find out more information please check:
89 `http://libmemcached.org/ <http://libmemcached.org/>`_
90
91
92 --------
93 SEE ALSO
94 --------
95
96
97 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`