redis key操作
root@tts-0001:~# redis-cli
redis 127.0.0.1:6379> keys *
(empty list or set)
redis 127.0.0.1:6379> set cache ehcache
OK
redis 127.0.0.1:6379> keys *
1) "cache"
redis 127.0.0.1:6379> set file sysfile
OK
redis 127.0.0.1:6379> keys *
1) "file"
2) "cache"
redis 127.0.0.1:6379> randomkey
"file"
redis 127.0.0.1:6379> randomkey
"cache"
redis 127.0.0.1:6379> ttl cache
(integer) -1
redis 127.0.0.1:6379> ttl caches
(integer) -1
redis 127.0.0.1:6379> exists cache
(integer) 1
redis 127.0.0.1:6379> exists caches
(integer) 0
redis 127.0.0.1:6379> rename cache caches
OK
redis 127.0.0.1:6379> keys *
1) "caches"
2) "file"
redis 127.0.0.1:6379> rename caches caches
(error) ERR source and destination objects are the same
redis 127.0.0.1:6379> rename cache caches
(error) ERR no such key
redis 127.0.0.1:6379> type cache
none
redis 127.0.0.1:6379> type caches
string
redis 127.0.0.1:6379> select 1
OK
redis 127.0.0.1:6379[1]> keys *
(empty list or set)
redis 127.0.0.1:6379[1]> select 0
OK
redis 127.0.0.1:6379> move caches 1
(integer) 1
redis 127.0.0.1:6379> move caches 1
(integer) 0
redis 127.0.0.1:6379> select 1
OK
redis 127.0.0.1:6379[1]> keys *
1) "caches"
redis 127.0.0.1:6379[1]> quit
上一篇: java基础之IO流
推荐阅读
-
Redis 主从复制
-
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
-
缓存管理之MemoryCache与Redis的使用
-
.Net Core API使用ODP.NET操作Oracle数据库
-
C#中对文件File常用操作方法的工具类
-
Word/Excel文档操作API哪家强?一张表带你了解Aspose和Spire系列全功能对比
-
Deepin换了层皮?骗钱的?统一操作系统UOS官方回应
-
统一操作系统UOS适配书生电子签章:满足特殊需求
-
回应质疑:统一操作系统UOS的五大杀手锏
-
Laravel 下配置 Redis 让缓存、Session 各自使用不同的 Redis 数据库