Use of Redis

Source: Internet
Author: User

What is Redis?

Redis is an open source API that is written in ANSI C, supports the web, can be persisted in memory, key-value databases, and provides multiple languages. Redis is a key-value storage system. Similar to memcached, it supports storing more value types, including string (string), list (linked list), set (set), Zset (sorted set-ordered collection), and hash (hash type).                                          These data types support Push/pop, Add/remove, and intersection-set and difference sets, and richer operations, and these operations are atomic. --a summary of Baidu Encyclopedia

Redis installation (Linux)

Cd/usr/local

wget http://download.redis.io/releases/redis-3.0.7.tar.gz get Redis installation package

Tar xvf redis-3.0.7.tar.gz

CD redis-3.0.7

Make

Make && Install

Redis Common Commands

Redis-server redis.conf # #启动redis

REDIS-CLI # #进入redis客户端 (no password status) | Redis-cli-a YourPassword # #进入redis客户端 (with password status)

REDIS-CLI Shutdown # #停止redis服务

Redis Basic Operations

Keys * # #查看redis中存在的所有的键

Set Word HelloWorld # #向redis中插入键值对数据, key is word, value is HelloWorld

Get word # #根据键取值 with a result of HelloWorld

exists Word # #查看键是否存在

Del Word # #删除当前key

Expire Word # #为相应的键设置过期时间

Persist Word # #移除当前key的过期时间

Randomkey # #随机返回一个key

Type DataList # #返回值得数据类型

Lpush DataList Redis # #向redis插入数据redis到集合头部 (left)

Rpush DataList org # #向redis插入数据org到集合尾部 (right)

Lrange DataList 0 4 # #查询集合中的索引为0-4 Data Flashall # #清空所有数据

For more information, please see the official Redis documentation

How Redis is used in Java: Spring-redis integration


The use of Redis is first written here.

Use of Redis

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.