Redis is an in-memory remote database that offers high performance, replication, and a unique data model to produce a platform for solving problems.
Redis is a very fast non-relational database that stores a mapping of keys to five different types of values.
Redis supports 5 types of data structure:
contains: Strings, integers, or floating-point values We can: GET, SET or DEL String.
127.0.0.1:6379> set hello world
127.0.0.1:6379> get hello "world"
Linked list of strings
We can: LPUSH/RPUSH, LPOP/RPOP items to(from) the front and back.
We can fetch an item at a given position using LINDEX and fetch a range
of items with LRANGE.
we can also remove items, insert items in the middle, trim the list to be a particular size (discarding items from one or both ends), and more
Unordered collection of unique strings
SETs are similar to LISTs in that they’re a sequence of strings, but unlike LISTs, Redis SETs use a hash table to keep all strings unique Commands:
SADD: Add item to set
SREMOVE: remove item to set
SISMEMBER: Check if item is member of set
SMEMBERS: return all members of a set
SINTER: Find set intersection
SUNION: Find set union
SDIFF: Difference between two sets
Unordered hash table of keys to values Commands:
HSET: store the value at the key
HGET: fetch value at the given hash key
HGETALL: fetch entire hash
HDEL: remove a key from the hash, if it exists.
ordered mapping of string members to floating-point scores, ordered by score ZSETs hold a type of key and value. The keys (called members) are unique, and the values called scores) are limited to floating-point numbers Commands:
ZADD: Adds member with the given score to the set
ZRANGE: Fetches the items in the ZSET from their positions in sorted order
ZRANGEBYSCOREL:Fetches items in the ZSET based on a range of scores
ZREM: Removes the item from the ZSET, if it exists