Memcached set 命令
set 无条件写入(存在就覆盖)。
Key Pointsset 是「有则覆盖、无则新增」的写入;值长度必须和声明的一致。
用法
Shell
set user:1 0 0 11
alice-hello
get user:1Output
STORED
VALUE user:1 0 11
alice-hello
END常见错误
Shell
set k 0 0 5
abcdefgOutput
CLIENT_ERROR bad data chunkThe value byte count must exactly match the length in set. One char off yields
CLIENT_ERROR bad data chunk. Let the client send the exact byte length; don't type it by hand.用法
Shell
set user:1 0 0 11
alice-hello
get user:1Output
STORED
VALUE user:1 0 11
alice-hello
END常见错误
Shell
set k 0 0 5
abcdefgOutput
CLIENT_ERROR bad data chunk值字节数必须严格等于 set 声明的长度。多一个少一个字符都会收到
CLIENT_ERROR bad data chunk。程序里写入时让客户端按字节数发送,别手敲。