Redis:https://github.com/msopentech/redis/releases.
After decompression, run redis-server.exe redis.windows.conf . Such as:
Do not close the Redis-server.exe window, open redis-cli.exe-h, such as:
The next step is to implement a simple command!
View all Keys
Keys *
View Key Types
Type MyKey
Operation:
1. String Type:
Create and modify: Set user ' Zhangsan '
Get the value of key: Get user
Delete key: Del user
2. Hash Type:
Single Value creation: Hset users ID 1,hset users name ' Zhangsan '
Single value display: Hget users ID
Multi-value creation: Hmset users ID 1 name ' Zhangsan ' age 20
Multi-value display: Hmget Users ID name age//display three data
Hgetall Users
Delete a key in the hash: Hdel users age
3.list type (stack structure)
Created: Lpush mylist ' aaa '
Display: Lrange mylist 0-1//Full display
Modify an element: LSet mylist 0 ' CCC '//change the value of the No. 0 position to CCC
Delete List:del MyList
Pop up an element: Lpop mylist
In addition to the reserved, the other deleted: LTrim mylist 0 1//0 to 1 left, other deletions
Remove an element equal to value
Lrem key 0 ' eee '
Specify the value of the underlying in the View list
Lindex mylist 1//See value of 2nd
4.set type
Create:
Sadd MySet ' AAA '
Show:
Smembers MySet
5. Ordered set (sorted set)
Create:
Zadd mysort 1 ' AAA '
Zadd mysort 3 ' CCC '
Zadd mysort 2 ' BBB '
Show:
Zrange Mysort 0-1 Withscores
6. Handling of Things
Multi
More than one command
Exec
7. Execute the Script
Eval ' command '
Redis database installation and simple additions and deletions