## **DATA TYPES** ### **Redis Strings** * SET: sets a value to a key * GET: gets a value from a key * DEL: deletes a key and its value * INCR: atomically increments a key * INCRBY: increments a key by a designated values * EXPIRE: the length of time that a key should exist (denoted in seconds) ### Redis Lists - collection of ordered values * LPUSH: Add a value to the beginning of a list * RPUSH: Add a value to the end of a list * LPOP: Get and remove the first element in a list * RPOP: Get and remove the last element in a list * LREM: Remove elements from a list * LRANGE: Get a range of elements from a list * LTRIM: Modifies a list so leave only a specified range * LINDEX: Gets an element from a list by its index * LLEN: Gets the length of a list ### Redis Sets - unordered collections of strings (can combine strings) * SADD: Add one or members to a set * SMEMBERS: Get all set members * SINTER: Find the intersection of multiple sets * SISMEMBER: check if a value is in a set * SRANDMEMBER: Get a random set member * SCARD: Gets the number of members in a set * SDIFF(STORE): Subtracts multiple sets (and stores the resulting set in a key) * SINTER(STORE): Intersects multiple sets (and stores the resulting set in a key) * SUNION(STORE): Adds multiple sets (and stores the resulting set in a key)= ### Redis Sorted Sets - mix between a Set and a Hash * ZADD: Adds members to a sorted set * ZRANGE: Displays the members of a sorted set arranged by index (with the default low to high) * ZREVRANGE: Displays the members of a sorted set arranged by index (from high to low) * ZREM: Removes members from a sorted set * ZCARD: Gets the number of members in a sorted set * ZRANK: Determines the index of a member in a sorted set ### Redis Hashes - useful to represent objects with many fields * HMSET: Sets up multiple hash values * HSET: Sets the hash field with a string value * HGET: Retrieves the value of a hash field * HMGET: Retrieves all of the values for given hash fields * HGETALL: Retrieves all of the values for in a hash