Memcached set 命令

set 无条件写入(存在就覆盖)。

Beginner
Key Pointsset 是「有则覆盖、无则新增」的写入;值长度必须和声明的一致。

用法

Shell
set user:1 0 0 11
alice-hello
get user:1
Output
STORED
VALUE user:1 0 11
alice-hello
END

常见错误

Shell
set k 0 0 5
abcdefg
Output
CLIENT_ERROR bad data chunk
The 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.

Friends & Partners