1MEMCACHED_AUTO(3)            libmemcached-awesome            MEMCACHED_AUTO(3)
2
3
4

NAME

6       memcached_auto - Incrementing and Decrementing Values
7

SYNOPSIS

9       #include <libmemcached/memcached.h>
10              Compile and link with -lmemcached
11
12       memcached_return_t  memcached_increment(memcached_st  *ptr,  const char
13       *key, size_t key_length, uint32_t offset, uint64_t *value)
14
15       memcached_return_t memcached_decrement(memcached_st  *ptr,  const  char
16       *key, size_t key_length, uint32_t offset, uint64_t *value)
17
18       memcached_return_t  memcached_increment_with_initial(memcached_st *ptr,
19       const char *key, size_t key_length, uint64_t offset, uint64_t  initial,
20       time_t expiration, uint64_t *value)
21
22       memcached_return_t  memcached_decrement_with_initial(memcached_st *ptr,
23       const char *key, size_t key_length, uint64_t offset, uint64_t  initial,
24       time_t expiration, uint64_t *value)
25
26       memcached_return_t  memcached_increment_by_key(memcached_st *ptr, const
27       char *group_key,  size_t  group_key_length,  const  char  *key,  size_t
28       key_length, uint32_t offset, uint64_t *value)
29
30       memcached_return_t  memcached_decrement_by_key(memcached_st *ptr, const
31       char *group_key,  size_t  group_key_length,  const  char  *key,  size_t
32       key_length, uint32_t offset, uint64_t *value)
33
34       memcached_return_t memcached_increment_with_initial_by_key(memcached_st
35       *ptr, const char *group_key, size_t group_key_length, const char  *key,
36       size_t  key_length,  uint64_t  offset, uint64_t initial, time_t expira‐
37       tion, uint64_t *value)
38
39       memcached_return_t memcached_decrement_with_initial_by_key(memcached_st
40       *ptr,  const char *group_key, size_t group_key_length, const char *key,
41       size_t key_length, uint64_t offset, uint64_t  initial,  time_t  expira‐
42       tion, uint64_t *value)
43
44              Parameters
45
46ptr -- pointer to an initialized memcached_st struct
47
48group_key -- key namespace
49
50group_key_length -- length of the key namespace without
51                       any terminating zero
52
53key -- the key
54
55key_length -- length of the key without any terminating
56                       zero
57
58offset -- offset to increment/decrement
59
60initial  --  initial  value  if  key does not exist and
61                       expiration is not MEMCACHED_EXPIRATION_NOT_ADD
62
63expiration -- expiration as a unix timestamp or as rel‐
64                       ative expiration time in seconds
65
66value  --  the resulting value after initialization/in‐
67                       crement/decrement
68
69              Returns
70                     memcached_return_t indicating success
71

DESCRIPTION

73       memcached(1) servers have the ability to increment and  decrement  keys
74       (overflow  and  underflow are not detected). This gives you the ability
75       to use memcached to generate shared sequences of values.
76
77       memcached_increment() takes a key and  key_length  and  increments  the
78       value  by  the  offset passed to it. The value is then returned via the
79       uint32_t value pointer you pass to it.
80
81       memcached_decrement() takes a key and  key_length  and  decrements  the
82       value  by  the  offset passed to it. The value is then returned via the
83       uint32_t value pointer you pass to it.
84
85       memcached_increment_with_initial() takes a key and key_length  and  in‐
86       crements  the value by the offset passed to it. If the object specified
87       by key does not exist, one of two things may happen: If the  expiration
88       value is MEMCACHED_EXPIRATION_NOT_ADD, the operation will fail. For all
89       other expiration values, the operation  will  succeed  by  seeding  the
90       value for that key with a initial value to expire with the provided ex‐
91       piration time.  The flags will be set to zero. The value  is  then  re‐
92       turned  via the uint32_t value pointer you pass to it. memcached_incre‐
93       ment_with_initial is only available when using the binary protocol.
94
95       memcached_decrement_with_initial()  takes  a  key  and  key_length  and
96       decrements  the  value by the offset passed to it. If the object speci‐
97       fied by key does not exist, one of two things may happen: If the  expi‐
98       ration  value is MEMCACHED_EXPIRATION_NOT_ADD, the operation will fail.
99       For all other expiration values, the operation will succeed by  seeding
100       the value for that key with a initial value to expire with the provided
101       expiration time.  The flags will be set to zero. The value is then  re‐
102       turned   via   the   uint32_t   value   pointer   you   pass   to   it.
103       memcached_decrement_with_initial() is only available when using the bi‐
104       nary protocol.
105
106       memcached_increment_by_key(),             memcached_decrement_by_key(),
107       memcached_increment_with_initial_by_key(),                          and
108       memcached_decrement_with_initial_by_key() are master key equivalents of
109       the above.
110

RETURN VALUE

112       A value of type memcached_return_t  is returned.  On success that value
113       will  be MEMCACHED_SUCCESS.  Use memcached_strerror() to translate this
114       value to a printable string.
115

SEE ALSO

117       memcached(1) libmemcached(3) memcached_strerror(3)
118
119
120
121
1221.1                              Nov 09, 2022                MEMCACHED_AUTO(3)
Impressum