Memcached prepend 命令

Memcached 教程 · 2019-03-08 22:58:03

Memcached prepend 命令用于向已存在 key(键)value(数据值) 前面追加数据 。

语法:

prepend 命令的基本语法格式如下:

prepend key flags exptime bytes [noreply]
value

参数说明如下:

  • key:键值 key-value 结构中的 key,用于查找缓存值。
  • flags:可以包括键值对的整型参数,客户机使用它存储关于键值对的额外信息 。
  • exptime:在缓存中保存键值对的时间长度(以秒为单位,0 表示永远)
  • bytes:在缓存中存储的字节数
  • noreply(可选): 该参数告知服务器不需要返回数据
  • value:存储的值(始终位于第二行)(可直接理解为key-value结构中的value)

实例

实例如下:

  • 首先我们在 Memcached 中存储一个键 codercto,其值为 memcached。
  • 然后,我们使用 get 命令检索该值。
  • 然后,我们使用 prepend 命令在键为 codercto 的值前面追加 "redis"。
  • 最后,我们再使用 get 命令检索该值。
set codercto 0 900 9
memcached
STORED
get codercto
VALUE codercto 0 9
memcached
END
prepend codercto 0 900 5
redis
STORED
get codercto
VALUE codercto 0 14
redismemcached
END

输出

如果数据添加成功,则输出:

STORED

输出信息说明:

  • STORED:保存成功后输出。
  • NOT_STORED:该键在 Memcached 上不存在。
  • CLIENT_ERROR:执行错误。

点击查看所有 Memcached 教程 文章: https://www.codercto.com/courses/l/34.html

查看所有标签

An Introduction to the Analysis of Algorithms

An Introduction to the Analysis of Algorithms

Robert Sedgewick、Philippe Flajolet / Addison-Wesley Professional / 1995-12-10 / CAD 67.99

This book is a thorough overview of the primary techniques and models used in the mathematical analysis of algorithms. The first half of the book draws upon classical mathematical material from discre......一起来看看 《An Introduction to the Analysis of Algorithms》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

html转js在线工具
html转js在线工具

html转js在线工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换