Redis
Redis Introduction
Redis is an open source (BSD licensed), in-memory data structure store used as a database, cache, message broker, and streaming engine. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams.
Redis has built-in replication, Lua scripting, LRU eviction, transactions, and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.
You can run atomic operations on these types, like appending to a string; incrementing the value in a hash; pushing an element to a list; computing set intersection, union and difference; or getting the member with highest ranking in a sorted set.
You can learn from Redis university.
Codelab
Dockerhub Redis: https://hub.docker.com/_/redis.
To try Redis in a quick way, spinning up a server and client instance separately in the same docker network(You can also use docker compose to assemble them):
1 | # Create default bridge network for Redis instances. |
From the client terminal, try example commands.
The usage of other commands please start with Data Types(below section) and
explore comprehensive commands here.
Client Libraries
Client libraries for various languages.
Data Types
The supported data types
Usage Cases
Cache
Redis can perform different roles based on user demands, the caching is one key role from them, please see client side caching and eviction strategies for reference.
In-Memory DB with Persistence
Redis can persist the data with different mechanism.
Message Broker
Redis also provides pub/sub functionality,
[ ] vs Stream data type?
Other Extensions
Redis can be extended to fit more roles, for example, storing and query JSON objects like Mongodb, full-text search as Elasticsearch , graph DB like Neo4j, please see here for details.