十三、Memcached gets 命令

十三、Memcached gets 命令

master ,这是我的小站,欢迎访问哦~~

Memcached gets 命令获取带有 CAS 令牌存 的 value(数据值)

语法

1
gets key

多个 key 使用空格隔开:

1
gets key1 key2 key3
  • key :键值 key-value 结构中的 key,用于查找缓存值

返回结果中,最后一列的数字为 CAS 令牌

如果 key 不存在,则返回空

范例

使用 gets 命令的输出结果中,在最后一列的数字 1 代表了 key 为 搜云库技术团队 的 CAS 令牌

gets 一个 key

1
2
3
4
5
6
7
8
9
10
11
12
flush_all
OK
set site 0 1000 11
tech.souyunku.com
STORED
set age 0 1000 2
28
STORED
gets site
VALUE site 0 11 18
tech.souyunku.com
END

gets 多个 key

1
2
3
4
5
6
7
8
9
10
11
12
13
14
flush_all
OK
set site 0 1000 11
tech.souyunku.com
STORED
set age 0 1000 2
28
STORED
gets site age
VALUE site 0 11 18
tech.souyunku.com
VALUE age 0 2 19
28
END

gets 多个 key 中有一个 key 不存在

那么不存在的那个 key 则不会返回任何信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
flush_all
OK
set site 0 1000 11
tech.souyunku.com
STORED
set age 0 1000 2
28
STORED
gets site age name
VALUE site 0 11 18
tech.souyunku.com
VALUE age 0 2 19
28
END

gets 一个不存在的 key

1
2
3
4
flush_all
OK
gets site
END