tencent cloud

Tencent Cloud Distributed Cache (Redis OSS-Compatible)

Release Notes and Announcements
Release Notes
Announcements
User Tutorial
Product Introduction
Overview
Product Strengths
Use Cases
Storage Engine
Product Series
Product Versions
Specifications and Performance
Read/Write Separation
Multi-AZ Deployment
Regions and AZs
Terms
Service Regions and Service Providers
Purchase Guide
Billing Overview
Pricing Center
Instance Purchasing
Renewal (Yearly/Monthly Subscription)
Refund (Yearly/Monthly Subscription)
Overdue Payments
Switching from Pay-as-You-Go to Yearly/Monthly Subscription
Getting Started
Quickly Creating an Instance
Connecting to Redis Instance
Operation Guide
Operation Overview
Connecting to a Database Instance
Managing Instances
Upgrade Instance
Management Node (Redis/ValKey Edition)
Multi-AZ Deployment Management
Backup and Restoration
Managing Accounts
Parameter Configuration
Slow Query
Access Management
Network and Security
Monitoring and Alarms
Event Management (Redis/ValKey Edition)
Data Migration
Global Replication for Redis Edition
Performance Optimization
Sentinel Mode
Development Guidelines
Naming Rules
Basic Usage Guidelines
Design Principles of Key and Value
Command Usage Guidelines
Design Principles of Client Programs
Connection Pool Configuration
Command Reference
Command Reference Overview
Redis Edition and Valkey Edition Command Compatibility
Version Command Usage Differences
Differences Between the Proxy Architecture and Direct Connection Mode
More Command Operations (Redis/Valkey Edition)
Memcached Edition Command Compatibility
Practical Tutorial
Building TencentDB for Redis® Client Monitoring Based on Spring Boot
Redis Client Connection Configuration Policy and Practice
Global SCAN Guide for Cluster Architecture
Eliminating Instances Securely
Hot Key and Big Key
AZ Migration Scheme
Troubleshooting
Connection Exception
Exception Analysis and Solution of Redisson Client Timeout Reconnection
Performance Troubleshooting and Fine-Tuning
API Documentation
History
Introduction
API Category
Making API Requests
Instance APIs
Parameter Management APIs
Other APIs
Backup and Restoration APIs
Region APIs
Monitoring and Management APIs
Log APIs
Data Types
Error Codes
FAQs
General
Connection and Login
Purchase
Service Agreement
Service Level Agreement
Terms of Service
Glossary
Contact Us

Basic Usage Guidelines

PDF
Focus Mode
Font Size
Last updated: 2024-11-05 10:22:22

Cache-Only Policy

Redis is only used to cache data. It stores all data in memory for quicker access. However, using it to persist data may result in data loss because it can’t store data in memory persistently after a power failure.

Non-Unique Data Source Policy

Since Redis is used for caching, cache misses are possible, so it cannot be relied upon as the sole source of data. In case of an exception when accessing Redis, the backend database needs to be queried.

Key Eviction Policy

Set the maxmemory-policy as needed. The default policy is noeviction, which means that keys will not be deleted. When memory is used up, OOM will occur. So we recommend that you modify the eviction policy once the instance is created to reduce OOM.

Configurable memory eviction policy

Select one of the following eviction policies for maxmemory-policy when the Redis in-memory cache was used up. LRU (least recently used) and TTL (time to live) are implemented by randomized and approximation algorithms.
allkeys-lru: Delete keys based on the LRU algorithm, regardless of whether the data has a timeout attribute, until enough space is freed up.
allkeys-random: Randomly delete keys until enough space is freed up.
volatile-lru: Delete expired keys based on the LRU algorithm until enough space is freed up.
volatile-random: Randomly delete expired keys until enough space is freed up.
volatile-ttl: Delete data that is about to be expired based on the TTL attribute of key-value pairs. If there is no recently expiring data, the policy will fall back to "noeviction".
noeviction: Evict no data, reject all write operations, and return the error message "(error) OOM command not allowed when used memory" to the client. Redis will only respond to read operations.

Suggestions

When Redis is used as a cache, it is recommended to use the "allkeys-lru" eviction policy. This policy evicts the keys least frequently used. By default, if a key is least frequently used, it is also less likely to be accessed in the future, so it is evicted.
When Redis is used as data persistence and caching in a hybrid manner, the volatile-lru policy can be used. As Redis is not recommended to store data persistently, it is only considered as an alternative.

 




Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback