Redis database installation and simple additions and deletions

Source: Internet
Author: User
Tags delete key redis

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.