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