When do you tend to choose redis?
1. Complex data structure
When the value is a complex data structure such as hash, list, set, ordered set, etc., it is more appropriate to choose redis, because mc cannot meet such needs.
Typical scenarios: user messages, comments, order lists, etc.
2. Persistence
mc does not support persistence
But the use of redis persistence It should be noted that
Never use redis as a database:
1) Regular snapshots of redis cannot guarantee that data will not be lost
2) The AOF of redis will reduce efficiency. And it cannot support large amounts of data
caching scenarios. What are the pros and cons of turning on persistence?
Advantages: The down machine is restarted, hotspot data can be quickly restored in the memory, and the database pressure is shared. There is no cache warm-up process.
Disadvantages: After redis hangs, the data in the database is modified, which may cause Data in redis is inconsistent
Read-only scenarios, or some business scenarios that allow inconsistencies, you can try to enable the redis persistence function
3, natural high availability
redis naturally supports clusters Function, can realize master-slave replication, read-write separation
Redis officially provides sentinel cluster management tool, which can realize master-slave service monitoring and automatic failover
Mc wants to achieve high availability, you need For secondary development
It should be noted that in most business scenarios, does the cache really need to be highly available?
1) In storage scenarios, cache miss is allowed in many cases.
2) If the cache fails, data can be read through DB in many cases.
4. The stored value is very The value storage of large
mc is up to 1m. If the stored value is very large, you can only use redis
For more Redis related knowledge, please visit Redis usage tutorial Column!
The above is the detailed content of Under what circumstances do you tend to use redis?. For more information, please follow other related articles on the PHP Chinese website!

The article discusses choosing shard keys in Redis Cluster, emphasizing their impact on performance, scalability, and data distribution. Key issues include ensuring even data distribution, aligning with access patterns, and avoiding common mistakes l

The article discusses implementing authentication and authorization in Redis, focusing on enabling authentication, using ACLs, and best practices for securing Redis. It also covers managing user permissions and tools to enhance Redis security.

The article discusses strategies for implementing and managing cache invalidation in Redis, including time-based expiration, event-driven methods, and versioning. It also covers best practices for cache expiration and tools for monitoring and automat

The article discusses using Redis for job queues and background processing, detailing setup, job definition, and execution. It covers best practices like atomic operations and job prioritization, and explains how Redis enhances processing efficiency.

The article explains how to use Redis for pub/sub messaging, covering setup, best practices, ensuring message reliability, and monitoring performance.

Article discusses monitoring Redis Cluster performance and health using tools like Redis CLI, Redis Insight, and third-party solutions like Datadog and Prometheus.

The article discusses using Redis for session management in web applications, detailing setup, benefits like scalability and performance, and security measures.

Article discusses securing Redis against vulnerabilities, focusing on strong passwords, network binding, command disabling, authentication, encryption, updates, and monitoring.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1
Powerful PHP integrated development environment

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
