Update cheatsheets

This commit is contained in:
Julien Le Coupanec 2017-11-18 17:22:37 +00:00
parent 5c488dab02
commit a6c52438bd
2 changed files with 18 additions and 18 deletions

View File

@ -1,15 +1,15 @@
##############################################################################
# *****************************************************************************
# BASICS
##############################################################################
# *****************************************************************************
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
##############################################################################
# *****************************************************************************
# STRINGS
##############################################################################
# *****************************************************************************
APPEND key value # append a value to a key
@ -34,10 +34,10 @@ EXPIRE key 120 # key will be deleted in 120 seconds
TTL key # returns the number of seconds until a key is deleted
##############################################################################
# *****************************************************************************
# LISTS
# A list is a series of ordered values
##############################################################################
# *****************************************************************************
RPUSH key value [value ...] # put the new value at the end of the list
@ -56,11 +56,11 @@ BLPOP key [key ...] timeout # remove and get the first element in a li
BRPOP key [key ...] timeout # remove and get the last element in a list, or block until one is available
##############################################################################
# *****************************************************************************
# SETS
# A set is similar to a list, except it does not have a specific order
# and each element may only appear once.
##############################################################################
# *****************************************************************************
SADD key member [member ...] # add the given value to the set
@ -74,11 +74,11 @@ SMOVE source destination member # move a member from one set to another
SPOP key [count] # remove and return one or multiple random members from a set
##############################################################################
# *****************************************************************************
# SORTED SETS
# A sorted set is similar to a regular set, but now each value has an associated score.
# This score is used to sort the elements in the set.
##############################################################################
# *****************************************************************************
ZADD key [NX|XX] [CH] [INCR] score member [score member ...] # add one or more members to a sorted set, or update its score if it already exists
@ -96,11 +96,11 @@ ZSCORE key member # get the score associated with the given mm
ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count] # return a range of members in a sorted set, by score
##############################################################################
# *****************************************************************************
# HASHES
# Hashes are maps between string fields and string values,
# so they are the perfect data type to represent objects.
##############################################################################
# *****************************************************************************
HGET key field # get the value of a hash field
@ -119,11 +119,11 @@ HSTRLEN key field # get the length of the value of a hash field
HVALS key # get all the values in a hash
##############################################################################
# *****************************************************************************
# HYPERLOGLOG
# HyperLogLog uses randomization in order to provide an approximation of the number
# of unique elements in a set using just a constant, and small, amount of memory
##############################################################################
# *****************************************************************************
PFADD key element [element ...] # add the specified elements to the specified HyperLogLog
@ -132,9 +132,9 @@ PFCOUNT key [key ...] # return the approximated cardinality of the se
PFMERGE destkey sourcekey [sourcekey ...] # merge N HyperLogLogs into a single one
##############################################################################
# *****************************************************************************
# PUBLICATION & SUBSCRIPTION
##############################################################################
# *****************************************************************************
PSUBSCRIBE pattern [pattern ...] # listen for messages published to channels matching the given patterns
@ -145,9 +145,9 @@ SUBSCRIBE channel [channel ...]  # listen for messages published to
UNSUBSCRIBE [channel [channel ...]] # stop listening for messages posted to the given channels
##############################################################################
# *****************************************************************************
# OTHER COMMANDS
##############################################################################
# *****************************************************************************
KEYS pattern # find all keys matching the given pattern