SET key value
Browse / Redis Cheatsheet
Redis Cheatsheet
A quick reference guide to Redis commands and concepts, covering data structures, operations, and configuration.
Data Structures & Basic Commands
      
        
            Strings
        
      
    
  | 
   | 
      
   Set the string value of a key.  | 
| 
   
  | 
      
   Get the value of a key.  | 
| 
   
  | 
      
   Set multiple keys to multiple values.  | 
| 
   
  | 
      
   Get the values of all the given keys.  | 
| 
   
  | 
      
   Increment the integer value of a key by one.  | 
| 
   
  | 
      
   Decrement the integer value of a key by one.  | 
| 
   
  | 
      
   Append a value to a key.  | 
| 
   
  | 
      
   Get the length of the value stored in a key.  | 
      
        
            Lists
        
      
    
  | 
   
  | 
      
   Prepend one or multiple values to a list.  | 
| 
   
  | 
      
   Append one or multiple values to a list.  | 
| 
   
  | 
      
   Remove and get the first element in a list.  | 
| 
   
  | 
      
   Remove and get the last element in a list.  | 
| 
   
  | 
      
   Get a range of elements from a list.  | 
| 
   
  | 
      
   Get the length of a list.  | 
| 
   
  | 
      
   Remove elements from a list.  | 
Hashes & Sets
      
        
            Hashes
        
      
    
  | 
   
  | 
      
   Set the string value of a hash field.  | 
| 
   
  | 
      
   Get the value of a hash field.  | 
| 
   
  | 
      
   Set multiple hash fields to multiple values.  | 
| 
   
  | 
      
   Get the values of all the given hash fields.  | 
| 
   
  | 
      
   Get all the fields and values in a hash.  | 
| 
   
  | 
      
   Delete one or more hash fields.  | 
| 
   
  | 
      
   Get the number of fields in a hash.  | 
      
        
            Sets
        
      
    
  | 
   
  | 
      
   Add one or more members to a set.  | 
| 
   
  | 
      
   Remove one or more members from a set.  | 
| 
   
  | 
      
   Get all the members in a set.  | 
| 
   
  | 
      
   Determine if a given value is a member of a set.  | 
| 
   
  | 
      
   Get the number of members in a set.  | 
| 
   
  | 
      
   Intersect multiple sets.  | 
| 
   
  | 
      
   Add multiple sets.  | 
Sorted Sets & Pub/Sub
      
        
            Sorted Sets
        
      
    
  | 
   
  | 
      
   Add one or more members to a sorted set, or update their score if they already exist.  | 
| 
   
  | 
      
   Remove one or more members from a sorted set.  | 
| 
   
  | 
      
   Return a range of members in a sorted set, by index.  | 
| 
   
  | 
      
   Return a range of members in a sorted set, by index, with scores ordered from high to low.  | 
| 
   
  | 
      
   Get the score associated with the given member in a sorted set.  | 
| 
   
  | 
      
   Get the number of members in a sorted set.  | 
| 
   
  | 
      
   Count the members in a sorted set with scores within the given values.  | 
      
        
            Pub/Sub
        
      
    
  | 
   
  | 
      
   Post a message to a channel.  | 
| 
   
  | 
      
   Subscribe the client to the given channels.  | 
| 
   
  | 
      
   Unsubscribe the client from the given channels.  | 
| 
   
  | 
      
   Subscribe the client to the given patterns.  | 
| 
   
  | 
      
   Unsubscribe the client from the given patterns.  | 
Transactions & Persistence
      
        
            Transactions
        
      
    
  | 
   
  | 
      
   Mark the start of a transaction block.  | 
| 
   
  | 
      
   Execute all commands in a transaction block.  | 
| 
   
  | 
      
   Discard all commands in a transaction block.  | 
| 
   
  | 
      
   Watch the given keys to determine execution of the MULTI/EXEC block.  | 
| 
   
  | 
      
   Forget about all watched keys.  | 
      
        
            Persistence
        
      
    
  | 
   
  | 
      
   Perform a synchronous save of the dataset to disk.  | 
| 
   
  | 
      
   Perform an asynchronous save of the dataset to disk.  | 
| 
   
  | 
      
   Return the UNIX timestamp of the last successful save to disk.  | 
| 
   
  | 
      
   Get the current save configuration.  | 
| 
   
  | 
      
   Asynchronously rewrite the append-only file.  |