1MEMCACHED_CAS_BY_KEY(3) libmemcached MEMCACHED_CAS_BY_KEY(3)
2
3
4
6 memcached_cas_by_key - Storing and Replacing Data
7
9 #include <libmemcached/memcached.h>
10
11 memcached_return_t memcached_cas(memcached_st *ptr, const char *key,
12 size_t key_length, const char *value, size_t value_length, time_t expi‐
13 ration, uint32_t flags, uint64_t cas)
14
15 memcached_return_t memcached_cas_by_key(memcached_st *ptr, const
16 char *group_key, size_t group_key_length, const char *key,
17 size_t key_length, const char *value, size_t value_length, time_t expi‐
18 ration, uint32_t flags, uint64_t cas)
19
20 Compile and link with -lmemcached
21
23 memcached_cas() overwrites data in the server as long as the "cas"
24 value is still the same in the server. You can get the cas value of a
25 result by calling memcached_result_cas() on a memcached_result_st(3)
26 structure. At the point that this note was written cas is still buggy
27 in memached. Turning on tests for it in libmemcached(3) is optional.
28 Please see memcached_set() for information on how to do this.
29
30 memcached_cas_by_key() method behaves in a similar method as the non
31 key methods. The difference is that it uses the group_key parameter to
32 map objects to particular servers.
33
34 memcached_cas() is testsed with the MEMCACHED_BEHAVIOR_USE_UDP behavior
35 enabled. However, when using these operations with this behavior on,
36 there are limits to the size of the payload being sent to the server.
37 The reason for these limits is that the Memcached Server does not allow
38 multi-datagram requests and the current server implementation sets a
39 datagram size to 1400 bytes. Due to protocol overhead, the actual limit
40 of the user supplied data is less than 1400 bytes and depends on the
41 protocol in use as, well as the operation being executed. When running
42 with the binary protocol, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, the size
43 of the key,value, flags and expiry combined may not exceed 1368 bytes.
44 When running with the ASCII protocol, the exact limit fluctuates
45 depending on which function is being executed and whether the function
46 is a cas operation or not. For non-cas ASCII set operations, there are
47 at least 1335 bytes available to split among the key, key_prefix, and
48 value; for cas ASCII operations there are at least 1318 bytes available
49 to split among the key, key_prefix and value. If the total size of the
50 command, including overhead, exceeds 1400 bytes, a MEM‐
51 CACHED_WRITE_FAILURE will be returned.
52
54 All methods return a value of type memcached_return_t. On success the
55 value will be MEMCACHED_SUCCESS. Use memcached_strerror() to translate
56 this value to a printable string.
57
59 To find out more information please check: http://libmemcached.org/
60
62 memcached(1) libmemached(3) memcached_strerror(3) memcached_set(3) mem‐
63 cached_append(3) memcached_add(3) memcached_prepend(3) mem‐
64 cached_replace(3)
65
67 Brian Aker
68
70 2011-2013, Brian Aker DataDifferential, http://datadifferential.com/
71
72
73
74
751.0.18 February 09, 2014 MEMCACHED_CAS_BY_KEY(3)