Redis - Technological watch
Introduction
Redis, which stands for Remote Dictionary Server, is a source-available, in-memory storage system. It was developed and maintained by Salvatore Sanfilippo, starting in 2009. Redis is used as a distributed, in-memory key-value database, cache, and message broker, with optional durability. Redis holds all data in memory and due to its design, it offers low-latency reads and writes, making it particularly suitable for use cases that require a cache. Redis is the most popular NoSQL database and is used in companies like Twitter, Airbnb, Tinder, Yahoo, Adobe, and Amazon.
On March 20, 2024, the Redis team announced on their blog that Redis is no longer open source:
Beginning today, all future versions of Redis will be released with source-available licenses. Starting with Redis 7.4, Redis will be dual-licensed under the Redis Source Available License (RSALv2) and Server Side Public License (SSPLv1). Consequently, Redis will no longer be distributed under the three-clause Berkeley Software Distribution (BSD).
https://redis.io/blog/redis-adopts-dual-source-available-licensing/
Here are some alternatives to Redis:
Usage
The syntax of Redis is very simple:
Data types
Redis supports different kinds of abstract data structures. Here are some of the core data types that Redis Community Edition implements (https://redis.io/docs/latest/develop/data-types/):
Note: if you want to have more information about some commands, you can visit the documentation here: https://redis.io/docs/latest/commands/
String
Redis strings are the most basic Redis data type, representing a sequence of bytes:
Hash
Redis hashes are record types modeled as collections of field-value pairs:
List
Redis lists are lists of strings sorted by insertion order:
Set
Redis sets are unordered collections of unique strings:
Sorted Set
Redis sorted sets are collections of unique strings that maintain order by each string’s associated score:
Stream
A Redis stream is a data structure that acts like an append-only log:
Bitmap
Redis bitmaps let you perform bitwise operations on strings:
Bitfield
Redis bitfields efficiently encode multiple counters in a string value:
Geo-spatial
Redis geo-spatial indexes are useful for finding locations within a given geographic radius or bounding box:
Ecosystem
Redis has a rich ecosystem of modules that extend its capabilities beyond the core data structure server. Here are some of the key modules (https://redis.io/docs/latest/integrate/):
- RedisSearch: RedisSearch is a full-text search engine that provides querying, secondary indexing, and full-text search for Redis. It allows you to index your data in a variety of ways, and then search and aggregate it very quickly.
- RedisGraph: RedisGraph is a graph database module for Redis. It implements the Cypher query language, and uses a fast, memory-efficient graph algorithm library called GraphBLAS. RedisGraph represents connected data in a compact format that allows for efficient processing of complex graph queries.
- RedisBloom: RedisBloom is a module that provides probabilistic data structures to Redis. It includes structures like Bloom filters and Count-Min sketches, which allow you to handle tasks like membership queries and frequency counting in a memory-efficient way.
- RedisJSON: RedisJSON is a module that provides native JSON capabilities to Redis. It allows you to store, update, and fetch JSON values from Redis keys.
- RedisAI: RedisAI is a module that turns Redis into an AI server. It provides a set of commands for running popular deep learning models, and it allows you to execute AI operations in real-time.
- RedisTimeSeries: RedisTimeSeries is a module that provides time series data structures to Redis. It allows you to store, retrieve, and analyze time series data at high speeds.
- RedisGears: RedisGears is a serverless engine for transaction, batch, and event-driven operations. It allows you to execute scripts that can process data across all of Redis’ data structures.
When NOT to Use Redis
- Big Data Storage: Redis stores data in RAM, making it less suitable for handling large datasets. For extensive data storage, it’s better to use Redis for caching purposes rather than as a primary database.
- ACID Transactions: Redis does not fully support ACID (Atomicity, Consistency, Isolation, Durability) transactions. For more details, you can read my blog post on the CAP theorem.
When to Use Redis
- Caching: Redis is excellent for caching, which can significantly speed up data access and improve application performance.
- Session Management: Use Redis to handle sessions efficiently, providing fast and reliable session storage.
- Queues: Redis is excellent for transferring data between servers using queues, facilitating smooth and reliable data handling in real-time applications.
Pricing
For additional details on pricing and licenses, please follow the provided links:
Try with Docker
You can easily try Redis with docker:
Atomic design - Technological watch
Learn what is the atomic design in less than 5 minutes !
Falco - Technological watch
Learn how to protect your Kubernetes cluster in less than 5 minutes !
Atomic distribution - Fedora Silverblue - Technological watch
Learn what is an Atomic distribution in less than 5 minutes !
RabbitMQ - Technological watch
Learn what is RabbitMQ in less than 5 minutes !
OpenAPI / Swagger - Technological watch
Learn what is OpenAPI / Swagger in less than 5 minutes !
Svelte - Technological watch
Learn what is Svelte in less than 5 minutes !
PicoCSS - Technological watch
Learn what is PicoCSS in less than 5 minutes !
Terraform - Technological watch
Learn what is Terraform in less than 5 minutes !