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