Redis / Cache
32 notes
Some notes are currently available only in Chinese. English translations are shown when available.
- 1.11 Redis Benchmarkinghistorical
Benchmark Lua scripts and pipelines with redis-benchmark, plus practical benchmarking notes.
- 1.12 Cloud Redishistorical
Historical Tencent Cloud Redis notes covering topology, availability-zone deployment, consistency, availability, scalability, cost, parameters, and monitoring.
- 2.1 Redis BloomFilterhistorical
A Redis-based BloomFilter implementation idea using BitMaps and automatic expansion.
- 2.2 Redis RateLimiterhistorical
A Redis-based rate limiter using a counter algorithm and Lua scripts.
- 2.3 Redis Data Structureshistorical
1. Redis DB - redisDb is the data structure used by Redis to represent a DB and contains a dict; dict is the K-V data structure in Redis and contains dictht; dictht is an array whose elements are dictEntry nodes; dictEntry.next uses chaining to resolve hash collisions
- 2.4 Redis Asynchronous Queuehistorical
Simple Redis asynchronous-queue patterns with lists, blocking pop, Pub/Sub, and sorted sets.
- 2.5 Redis Distributed Lockshistorical
1. What is a Redis distributed lock - A distributed lock implemented based on Redis 2. Redis distributed lock implementation 2.1. Single instance 2.1.1. Locking - Set a key when it does not exist - SET NX guarantees atomicity - The key guarantees mutual exclusion - The value guarantees that locking and unlocking are performed by the same client
- 2.6 Redis Key Design Tipshistorical
1. MySQL -> Redis 1.1. Single table - Primary key column: set table-name:primary-key-name primary-key-value - Other columns: set table-name:primary-key-name:primary-key-value:column-name column-value 1.1.1. User table: query a record by primary key
- 2.7 Redis Commandshistorical
1. Redis general commands - keys pattern queries matching keys - Redis supports fuzzy key matching with three wildcards: *, ?, [] - * matches any number of characters - ? matches one character - [] matches one character inside the brackets - redis-cli can only query data on the current node - SCAN cursor
- 3.1 Redis Thread Modelhistorical
Redis's Reactor model, its single-threaded command execution, why it is fast, and Redis 6.x multi-threaded I/O.