Redis study notes - use

Connect redis

# Local execution
./redis-cli

# 
./redis-cli -h host -p port -a password

Basic grammar

Key

# command effect
1 del key Delete key
2 dump key Serialize the key and return the serialized value
3 exists key Check if the key exists
4 expire key seconds Set timeout, in seconds
5 expireat key timestamp Set timeout, receive timestamp
6 expire key milliseconds Set timeout, in milliseconds
7 expireat key milliseconds-timestamp Set timeout, in milliseconds, receive timestamp
8 keys pattern View the key that matches the matching rule
9 randomkey Return a key from the database
10 rename key new_key Rename
11 renamex key new_key Rename, change to new_key only if new_key does not exist
12 type key Returns the type of value stored by the key lock

String

# command effect
1 set key value Set key value
2 get key Get the key
3 getrange key start end Get the element in the index range of the value corresponding to the key. The index starts from 0 and is opened on both sides.
4

Intelligent Recommendation

Redis study notes ()-Redis installation and use under Windows

Redis download Redis download address:https://github.com/MSOpenTech/redis/releases If the download is too slow, you can download domestic resources: Redis installation unzip Will be downloadedRedis-x6...

[redis study notes] Six, Redis master-slave replication and mode use

Redis master-slave replication Overview Similar to mysql's master-slave replication idea, the data of the master server is automatically synchronized to the slave server according to the configuration...

[redis study notes] 2. Introduction to Redis and the use of five basic types

Redis overview and introduction Overview Redis is the abbreviation of Remote Dictionary Server. It is completely open source and free, written in C language, and complies with the BSD protocol. It is ...

Redis study notes two: Use Redis in Java projects

Redis data types Redis supports five data types: string (string), hash (hash), list (list), set (collection) and zset (sorted set: ordered set). String String is the most basic type of redis. You can ...

Redis database: "Redis in Action" (Redis in Action) study notes Chapter 2 Use Redis to build web applications

Write in front: After reading Chapter 1, Chapter 2 is mainly used as a practical guide to tell you what you can do with Redis. In the code of this chapter, there will be more Redis commands that did n...

More Recommendation

Redis study notes - redis lock

Several implementations of redis locking Redis lock classification The lock command table that redis can use isINCR、SETNX、SET 2. The first type of lock commandINCR The idea of ​​this locking is that i...

Redis study notes --- redis cluster

2019 Unicorn Enterprise Heavy Gold Recruitment Python Engineer Standard >>> First, the introduction Redis cluster is a facility that can share data between multiple nodes. Redis cluster provi...

Redis study notes---Redis transaction

Preface Redis transactions can execute multiple commands at once (sequentially executed serially, no other commands will be inserted during execution, and no jams are allowed) 1 Introduction Redis tra...

Redis study notes-Redis and Lua

Benefits of using Lua Lua scripts are executed atomically in Redis, and no other commands will be inserted during execution. Lua scripts can help developers and operation and maintenance personnel cre...

[Redis study notes]-Redis transaction

Redis transaction What is Redis transaction The transaction is a separate isolated operation: all commands in the transaction are serialized and executed sequentially. During the execution of the tran...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top