Redis Cheat Sheet



This is a super light weight reference for the interactive mode of the Redis CLI tool. I really just want to use it to explore what data is in Redis, so the emphasis is on getting in and listing data rather than setting values.

Documentation for all the Redis commands is at https://redis.io/commands

Starting the CLI in interactive mode

Connect to a locally running instance of Redis and start the interactive REPL:

Configure hints:

Get help for a command:

Query Config

The Redis cheat sheet includes basic syntax and methods to help you using Redis. Redis is an open-source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. Redis Cheat Sheet by James Hopkin (tasjaevan) via cheatography.com/18964/cs/2046/ Scripts EVAL Run EVALSHA Run cached SCRIPT EXISTS Check by hash SCRIPT FLUSH Clear cache SCRIPT KILL Kill running script SCRIPT. REDIS cheatsheet v1.0 starting the server cd redis;./redis-server running the client./redis-cli exists key Test if specified key exists. Return: 1 if exists, 0 if not commands generic commands for all types. Redis Cheat Sheet: Online or printable function reference for Redis. Who is using Redis.Books. The following is a list of books covering Redis that are already published. Books are ordered by release date (newer books first). Mastering Redis (Packt, 2016) by Jeremy Nelson.

Deprecated starting with Redis 5. Use REPLICAOF instead. REPLICAOF host port Make the server a replica of another instance, or promote it as master. SLOWLOG subcommand argument Manages the Redis slow queries log.

List all sorts of useful config:

Select a database (key space)

Show the max number of databases this server is configured to host:

List the available databases:

Select the redis database to use:

Find out what’s in a key space

List all the keys in the currently selected keyspace:

Batch list keys. Pass 0 the first time, then the cursor number given by Redis next time:

Query key value type

Find out what data structure a key holds:

Redis

String types

Getting, setting and removing keys holding string values:

Set types

List all members of a key holding a set data structure:

Hash types

List all keys and values of a hash data structure:

List types

List all elements of a list data structure:

-1 refers to the last element of the list.

Redis Cheat Sheet Github

Expiring keys