Article directory
What is Redis
Redis is one of the most popular NoSQL databases (the full name is Not Only SQL, non-relational database). Redis is an open source written in ANSI C, contains a variety of data structures, supports network, memory-based, and optional persistence. The key-value storage database has the following characteristics:
1. Based on memory operation, high performance
2. Supports distributed, theoretically infinite expansion 3.
Key-value storage system
, Support network, log type, Key-Value database that can be memory-based and persistent, and provide APIs in multiple languages
Compared with other database types, Redis has the following characteristics:
1. C/S communication model
2. Single process and single thread model
3. Rich data types
4. Atomicity of operations
5. Persistence
6. High concurrent read and write
7 .support lua script
Environment configuration (under Windows)
Install
Redis installation address , open this installation address and download the compressed package file directly, and then unzip it, so the installation work is completed
run
Open cmd and enter redis-server.exe redis.windows.conf
run to indicate that the installation is complete
*这个窗口不能关!一旦关闭运行就停止了
simple command
start up:redis-cli.exe -h 127.0.0.1 -p 6379
select num 切换到num数据库(一共有16个数据库,刚启动默认第0个数据库)
set key value 插入键值对
get key 获取到key对应的value
keys * 获取全部的key
randomkey 获取随机一个key
type key 获取key对应的value的类型
del key 删除指定的键值对
flushdb 删除一个数据库中的全部内容
flushall 删除全部数据库中的内容