You are on page 1of 4

· 473 views · 2 pages

 0 ratings

Redis Cheat Sheet


Uploaded by Sourabh Verma

Redis Cheat Sheet Full description

    
Save 0% 0% Embed Print

Download now  Search document

Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
 

Redis Cheat Sheet


by James Hopkin (tasjaevan) via cheatography.com/18964/cs/2046/ 

Strings Lists (cont) Database

APPEND Append LPUSH Push onto start DEL Delete item

BITCOUNT Count set bits LPUSHX Push if list exists DUMP Serialise item

BITOP Bitwise operations LRANGE Access range EXISTS Check for key

BITPOS Find first set bit LREM Remove EXPIRE Set timeout on item

DECR Decrement integer LSET Set item by index EXPIREAT Set timeout by timestamp

DECRBY Subtract from integer LTRIM Remove start and/or end KEYS Get all keys matching pattern
items
GET Get by key MIGRATE Transfer an item between
RPOP Pop from end Redis instances
GETBIT Get bit by index
RPOPLPUSH Rotate MOVE Transfer an item between
GETRANGE Get substring
databases
RPUSH Push onto end
GETSET Set, returning old value
OBJECT Inspect item
RPUSHX Push onto end if list exists
INCR Increment integer
PERSIST Remove timeout
INCRBY Add to integer
Client/Server PEXPIRE Set timeout (ms)
INCRBYFLOAT Add to float
AUTH Request authentication PEXPIREAT Set timeout (ms timestamp)
MGET Get multiple
ECHO Return message PTTL Get item time to live (ms)
MSET Set multiple
PING Test connection RANDOMKEY Get random key
MSETNX Set multiple if don't exist
QUIT Close connection RENAME Change item's key
PSETEX Set with expiry (ms)    
SELECT Set current database by index RENAMENX Change item's key if new key
SET Set
doesn't exist
SETBIT Set bit by index
Sets RESTORE Deserialise
SETEX Set only if already exists
SADD Add item SCAN Iterate keys
SETNX Set if doesn't exist
SCARD Get size SORT Get or store sorted copy of
SETRANGE Set substring list, set or sorted set
SDIFF Get difference
STRLEN Get length TTL Get item time to live
SDIFFSTORE Store difference
Strings can be used as numbers, arrays, bit TYPE Get type of item
SINTER Intersection
sets and binary data
SINTERSTORE Store intersection

Lists SISMEMBER Check for item

SMEMBERS Get all


BLPOP Blocking left pop
SMOVE Move item to another set
BRPOP Blocking right pop
SPOP Pop random item
BRPOPLPUSH Blocking rotate
SRANDMEMBER Get random item
LINDEX Access by index
SREM Remove matching
LINSERT Insert next to
SSCAN Iterate items
LLEN Get length
SUNION Union
LPOP Pop from start
SUNIONSTORE Store union

By James Hopkin (tasjaevan) Published 8th May, 2014. Sponsored by Readability-Score.com


cheatography.com/tasjaevan/    Last updated 28th June, 2014.   Measure your website readability!
Page 1 of 2. https://readability-score.com

Continue for Free

Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
 

Redis Cheat Sheet


by James Hopkin (tasjaevan) via
(tasjaevan) via cheatography.com/18964/cs/2046/ 

Scripts Sorted sets (cont)

EVAL Run ZLEXRANGE Get items within


lexicographical
EVALSHA Run cached
range
SCRIPT EXISTS Check by hash
ZRANGEBYSCORE Get items within
SCRIPT FLUSH Clear cache
score range
SCRIPT KILL Kill running script
ZRANK Get item rank
SCRIPT LOAD Add to cache
ZREM Remove item(s)
Lua scripts access keys through the array ZREMRANGEBYLEX Remove items
KEYS and additional arguments through the within
array ARGV. lexicographical
range
Hashes
ZREMRANGEBYRANK Remove items
HDEL Delete item within rank range

HEXISTS

HGET
Check for item

Get item
You're Reading a Preview
ZREMRANGEBYSCORE Remove items
within score range

ZREVRANGE ZRANGE in
HGETALL Return all items
reverse order
HINCRBY
Upload your documents to download.
Add to integer value
ZREVRANGEBYSCORE ZRANGEBYSCOR
HINCRBYFLOAT Add to float value E in reverse order
   
HKEYS Return all keys ZREVRANK ZRANK in reverse
HLEN Get number of items order

HMGET Get multiple items Upload to Download


ZSCAN Iterate items

HMSET Set multiple items ZSCORE Get item score

HSCAN Iterate items ZUNIONSTORE Store union

OR
HSET Set item Lexicographical commands require all items to

HSETNX Set item if doesn't exist have the same score

HVALS Return all values


HyperLogLogs

Sorted sets Become a Scribd member to read and


PFADD Add items

download full documents.


ZADD Add item PFCOUNT Get approximate size

ZCARD Get number of items PFMERGE Merge HyperLogLogs

Start Your 30 Day FREE Trial


ZCOUNT Number of items within score
range

ZINCRBY Add to score

ZINTERSTORE Store intersection

ZLEXCOUNT Lexicographical range count

ZRANGE Get items within rank range

By James Hopkin (tasjaevan)
Hopkin (tasjaevan) Published 8th May, 2014. Sponsored by Readability-Score.com
cheatography.com/tasjaevan/    Last updated 28th June, 2014.   Measure your website readability!
Page 2 of 2. https://readability-score.com

Reward Your Curiosity


Everything you want to read.
Anytime. Anywhere. Any device.

Read free for 30 days

N C it t C l ti
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
No Commitment. Cancel anytime.

Share this document

Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com

You might also like