Brief introduction
Redis is an open source in-memory database, which can be used as a database, caching, and messaging middleware.
- Redis key-value cache and other products have the following three features:
Redis support persistent data, data in memory can be saved to disk, reboot to load when you can be reused.
Redis only supports simple key-value data types, while also providing a storage list, set, zset, hash and other data structures.
Redis supports backup data, i.e., data backup master-slave mode.
data structure
String
Backup
Common Commands
#ttl
Redis TTL 命令以秒为单位返回 key 的剩余过期时间。
#expire
Redis Expire 命令用于设置 key 的过期时间。key 过期后将不再可用。每次重新获取过期时间都会重置。
#PERSIST
Redis PERSIST 命令用于移除给定 key 的过期时间,使得 key 永不过期。
#Pttl
Redis Pttl 命令以毫秒为单位返回 key 的剩余过期时间。