Redis Basic Usage

Source: Internet
Author: User
Tags redis server

Redis Benefits
    • Unusually fast: Redis is very fast and can perform approximately 110000 setup operations per second, and 81,000 per second read operations.

    • Support for rich data types: Redis support most developers already know data types such as lists, collections, sortable collections, hashes, and so on.

      This makes it easy to solve a variety of problems in your application because we know which issues to work with which data types are better addressed.
    • Operations are atomic: All Redis operations are atomic, ensuring that when two customers access the Redis server at the same time, the updated values (the latest value) are obtained.

    • Multiutility Tools: Redis is a multifunctional utility that can be used in many such as: cache, Message delivery queue (Redis native support publish/subscribe), in applications such as: Web application sessions, website page hits, etc. any short data;

Download page management tool: Https://redisdesktop.com/download

Redis uses:

1.redis user's password, port description information: redis.windows-service.conf;

2. Open the cmd window in the path where the file is located, or open the administrator mode Redis-server

3. Open CMD window in this window, Run command: redis-cli-h 127.0.0.1-p 6379-a Password Enter.

4. Operation Command:

quit--exit

exists key--whether there is a key to return an integer 1 indicating existence; Returns an integer 0 indicating that it does not exist.

Set key value--sets a key value

Get key--Gets the value corresponding to this key

Del Key--delete this key and return an integer of 1 to indicate the deletion was successful. Returning 0 indicates that the deletion failed.

Keys u*--means to get all keys starting with u

Dbsize--Indicates the number of keys in the current database. 、

Flushdb--Delete all keys in the currently selected database

Flushall--Delete all keys from all databases

Mget key1 Key2 ...-Get the key value in bulk, there is no comma in the middle of key.

Redis Hash:

5.hset

Description: Sets the value of the field field in the hash table key to value

Example: Hset wangifo name WL

Get: Hget wanglianginfo Name

6.hmset Batch Setup

Hgetall wanglianginfo: Get all.

Redis list:

Example: Lpush myusers Alibaba

Lpush myusers Baidu

Lpush myusers Tengxun

Pop-up: Lpop myusers: LIFO, pop-up Tengxun, followed by Baidu, and finally Alibaba

Enquiry: lindex myusers index:index myusers 0;

Multiple queries: Lrange key start stop

Modification: LSet Key index value

Delete: Itrim key start stop explanation, Start-stop keep this area, other deletions.

Redis Basic Usage

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.