Understanding and Mitigating Common Cache Issues: Penetration, Breakdown, and Avalanche
Cache Penetration
Cache penetration occurs when a large number of requests target data that exists neither in the cache nor in the database. For example, if users repeatedly request non-existent order numbers like -1, these requests bypass the cache entirely and hit the database directly. This scenario can be exploited maliciously to overwhelm ...
Posted on Mon, 18 May 2026 23:33:18 +0000 by yes3no2
Ensuring Redis Cache and Database Consistency with Delayed Double Deletion
Redis Cache and Database Consistency
Caching improves performance and reduces database load, but introduces potential inconsistencies between cached data and the database. Inconsistent data leads to stale reads from the cache.
Non-Concurrency Scenarios
Update Cache First, Then Database
If cache udpate succeeds but database update fails, the cac ...
Posted on Mon, 18 May 2026 21:24:00 +0000 by DwarV
Using ReentrantReadWriteLock in JUC and Simple Applications
ReentrantReadWriteLock Introduction and Usage
Overview
ReentrantReadWriteLock is ideal for scenarios with far more read operations than write operations. It allows concurrent read access while ensuring mutual exclusion between reads and writes, or between writes and writes—similar to database shared locks (select ... from ... lock in share mode ...
Posted on Sun, 17 May 2026 07:45:46 +0000 by !jazz
Redis Core Knowledge for Java Backend Interviews
What is Redis
Redis is a high‑performance, in‑memory key‑value database that also supports optional data persistence. It is open‑source and written in C, widely used both as a cache and as a primary datastore for specialised scenarios.
Why Redis Is So Fast
In‑memory storage – data is served directly from RAM, avoiding disk I/O for most operati ...
Posted on Sat, 16 May 2026 00:09:43 +0000 by dave420
Addressing Cache Anomalies and Advanced Redis Mechanisms
Cache Anomalies
Cache Penetration: Requested data does not exist in the system.
Use a Bloom filter.
Cache Breakdown: A hot key expires.
Implement mutual exclusion locks.
Apply logical expiration (no actual TTL set).
Cache Avalanche: Numerous keys expire simultaneously.
Assign random expiration times.
Deploy a Redis cluster.
Cache Pen ...
Posted on Fri, 15 May 2026 18:47:14 +0000 by tekkenlord
Deploying and Configuring Varnish for Static-Dynamic Content Routing on CentOS
Building Varnish from Source
Begin by preparing the required system libraries. Compile and install PCRE2 from source:
tar -xzf pcre2-10.23.tar.gz
cd pcre2-10.23
./configure --prefix=/opt/pcre2
make && make install
Update the package configuration environment variable and install remaining dependencies via YUM:
export PKG_CONFIG_PATH=/o ...
Posted on Thu, 14 May 2026 23:38:54 +0000 by nscipione
Caching Strategies and Redis Implementation
Understanding Caching Concepts
Buffer vs. Cache
buffer: Primarily used for write operations, acting as a write buffer.
cache: Primarily used for read operations, serving as a read cache.
Both address speed inconsistencies and involve I/O operations.
Key Cache Considerations
1. Storage location (multi-level cache):
Client-side (browser cach ...
Posted on Thu, 14 May 2026 03:41:58 +0000 by Axeia
Analyzing the cache2go Go Caching Library
Overview
This analysis focuses on the cache2go library, a concurrency-safe caching solution written in Go. The goal is to dissect its core components and understand its design patterns. We will examine the project's strutcure, key data structures, and the implementation of its core functionalities, providing insihgts into how it manages cached ...
Posted on Wed, 13 May 2026 22:38:18 +0000 by franko75
Guava Cache: A High-Performance JVM-Level In-Memory Caching Library
Guava Cache is a robust, thread-safe in-memory caching library provided by Google's Guava toolkit. Built atop principles similar to ConcurrentHashMap, it extends core map functionality with rich cache-specific features—such as expiration, size constraints, automatic loading, and fine-grained concurrency control—while remaining lightweight and z ...
Posted on Tue, 12 May 2026 13:51:32 +0000 by waterox
Integrating Redis with Spring Boot for Caching, Lua Scripting, and Session Sharing
Integrating Redis as a Cache in Spring Boot
To use Redis as a caching layer in Spring Boot, include the spring-boot-starter-cache and spring-boot-starter-data-redis dependencies. Spring Boot auto-configures a RedisTemplate and, when caching is enabled, a RedisCacheManager.
Required Dependencies
<dependency>
<groupId>org.springfr ...
Posted on Sat, 09 May 2026 21:29:26 +0000 by katlis