1MEMCACHED_APPEND(3) libmemcached-awesome MEMCACHED_APPEND(3)
2
3
4
6 memcached_append - Appending to or Prepending Data
7
9 #include <libmemcached-1.0/memcached.h>
10 Compile and link with -lmemcached
11
12 memcached_return_t memcached_prepend(memcached_st *ptr, const char
13 *key, size_t key_length, const char *value, size_t value_length, time_t
14 expiration, uint32_t flags)
15
16 memcached_return_t memcached_append(memcached_st *ptr, const char *key,
17 size_t key_length, const char *value, size_t value_length, time_t expi‐
18 ration, uint32_t flags)
19
20 memcached_return_t memcached_prepend_by_key(memcached_st *ptr, const
21 char *group_key, size_t group_key_length, const char *key, size_t
22 key_length, const char *value, size_t value_length, time_t expiration,
23 uint32_t flags)
24
25 memcached_return_t memcached_append_by_key(memcached_st *ptr, const
26 char *group_key, size_t group_key_length, const char *key, size_t
27 key_length, const char *value, size_t value_length, time_t expiration,
28 uint32_t flags)
29
30 Parameters
31
32 • ptr -- pointer to an initialized memcached_st struct
33
34 • group_key -- key namespace
35
36 • group_key_length -- length of the key namespace without
37 any terminating zero
38
39 • key -- the key
40
41 • key_length -- length of the key without any terminating
42 zero
43
44 • value -- the value to append/prepend
45
46 • value_length -- the length of the value without any
47 terminating zero
48
49 • expiration -- expiration as a unix timestamp or as rel‐
50 ative expiration time in seconds
51
52 • flags -- 16 bit flags
53
54 Returns
55 memcached_return_t indicating success
56
58 memcached_prepend() and memcached_append are used to modify information
59 on a server. All methods take a key, and key_length to store the ob‐
60 ject. Keys are currently limited to 250 characters when using either a
61 version of memcached which is 1.4 or below, or when using the text pro‐
62 tocol. You must supply both a value and a length. Optionally you may
63 set an expiration time for the object and a 16 bit value (it is meant
64 to be used as a bitmap). flags is a 4 byte space that is stored along
65 the main value. Many sub libraries make use of this field, so in most
66 cases users should avoid making use of it.
67
68 memcached_prepend() places a segment of data before the last piece of
69 data stored. Currently expiration and key are not used in the server.
70
71 memcached_append() places a segment of data at the end of the last
72 piece of data stored. Currently expiration and key are not used in the
73 server.
74
75 memcached_prepend_by_key() and memcached_append_by_key() methods both
76 behave in a similar manner as the non key methods. The difference is
77 that they use their group_key parameter to map objects to particular
78 servers.
79
80 If you are looking for performance, memcached_set() with non-blocking
81 IO is the fastest way to store data on the server.
82
83 All of the above functions are tested with the
84 MEMCACHED_BEHAVIOR_USE_UDP behavior enabled. However, when using these
85 operations with this behavior on, there are limits to the size of the
86 payload being sent to the server. The reason for these limits is that
87 the Memcached Server does not allow multi-datagram requests and the
88 current server implementation sets a datagram size to 1400 bytes. Due
89 to protocol overhead, the actual limit of the user supplied data is
90 less than 1400 bytes and depends on the protocol in use as, well as the
91 operation being executed. When running with the binary protocol,
92 MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, the size of the key,value, flags
93 and expiry combined may not exceed 1368 bytes. When running with the
94 ASCII protocol, the exact limit fluctuates depending on which function
95 is being executed and whether the function is a cas operation or not.
96 For non-cas ASCII set operations, there are at least 1335 bytes avail‐
97 able to split among the key, key_prefix, and value; for cas ASCII oper‐
98 ations there are at least 1318 bytes available to split among the key,
99 key_prefix and value. If the total size of the command, including over‐
100 head, exceeds 1400 bytes, a MEMCACHED_WRITE_FAILURE will be returned.
101
103 All methods return a value of type memcached_return_t. On success the
104 value will be MEMCACHED_SUCCESS.
105
106 Use memcached_strerror() to translate this value to a printable string.
107
109 memcached(1) libmemcached(3) memcached_strerror(3) memcached_set(3)
110 memcached_add(3) memcached_cas(3) memcached_replace(3)
111
112
113
114
1151.1 Mar 06, 2023 MEMCACHED_APPEND(3)