docs: sanitize
[awesomized/libmemcached] / docs / source / libmemcached / memcached_append.rst
1 Appending or Prepending to data on the server
2 =============================================
3
4 .. index:: object: memcached_st
5
6 Appending or Prepending to data on the server
7
8 SYNOPSIS
9 --------
10
11 #include <libmemcached/memcached.h>
12
13 .. function:: memcached_return_t memcached_prepend(memcached_st *ptr, const char *key, size_t key_length, const char *value, size_t value_length, time_t expiration, uint32_t flags)
14
15 .. function:: memcached_return_t memcached_append(memcached_st *ptr, const char *key, size_t key_length, const char *value, size_t value_length, time_t expiration, uint32_t flags)
16
17 .. function:: memcached_return_t memcached_prepend_by_key(memcached_st *ptr, const char *group_key, size_t group_key_length, const char *key, size_t key_length, const char *value, size_t value_length, time_t expiration, uint32_t flags)
18
19 .. function:: memcached_return_t memcached_append_by_key(memcached_st *ptr, const char *group_key, size_t group_key_length, const char *key, size_t key_length, const char *value, size_t value_length, time_t expiration, uint32_t flags)
20
21 Compile and link with -lmemcached
22
23 DESCRIPTION
24 -----------
25
26 :func:`memcached_prepend` and memcached_append are used to
27 modify information on a server. All methods take a key, and its length to
28 store the object. Keys are currently limited to 250 characters when using
29 either a version of memcached which is 1.4 or below, or when using the text
30 protocol. You must supply both a value and a length. Optionally you
31 may test an expiration time for the object and a 16 byte value (it is
32 meant to be used as a bitmap). "flags" is a 4byte space that is stored
33 alongside of the main value. Many sub libraries make use of this field,
34 so in most cases users should avoid making use of it.
35
36 :func:`memcached_prepend` places a segment of data before the last piece
37 of data stored. Currently expiration and key are not used in the server.
38
39 :func:`memcached_append` places a segment of data at the end of the last
40 piece of data stored. Currently expiration and key are not used in the server.
41
42 :func:`memcached_prepend_by_key` and
43 :func:`memcached_append_by_key` methods both behave in a similar
44 method as the non key methods. The difference is that they use their
45 group_key parameter to map objects to particular servers.
46
47 If you are looking for performance, :func:`memcached_set` with non-blocking
48 IO is the fastest way to store data on the server.
49
50 All of the above functions are tested with the
51 `MEMCACHED_BEHAVIOR_USE_UDP` behavior enabled. However, when using
52 these operations with this behavior on, there are limits to the size of the
53 payload being sent to the server. The reason for these limits is that the
54 Memcached Server does not allow multi-datagram requests
55 and the current server implementation sets a datagram size to 1400 bytes. Due
56 to protocol overhead, the actual limit of the user supplied data is less than
57 1400 bytes and depends on the protocol in use as, well as the operation being
58 executed. When running with the binary protocol,
59 `MEMCACHED_BEHAVIOR_BINARY_PROTOCOL`, the size of the key,value,
60 flags and expiry combined may not exceed 1368 bytes. When running with the
61 ASCII protocol, the exact limit fluctuates depending on which function is
62 being executed and whether the function is a cas operation or not. For
63 non-cas ASCII set operations, there are at least 1335 bytes available
64 to split among the key, key_prefix, and value; for cas ASCII operations
65 there are at least 1318 bytes available to split among the key, key_prefix
66 and value. If the total size of the command, including overhead, exceeds
67 1400 bytes, a `MEMCACHED_WRITE_FAILURE` will be returned.
68
69 RETURN
70 ------
71
72 All methods return a value of type :type:`memcached_return_t`.
73 On success the value will be `MEMCACHED_SUCCESS`.
74 Use :func:`memcached_strerror` to translate this value to a printable
75 string.
76
77 SEE ALSO
78 --------
79
80 .. only:: man
81
82 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)` :manpage:`memcached_set(3)` :manpage:`memcached_add(3)` :manpage:`memcached_cas(3)` :manpage:`memcached_replace(3)`
83