Optimizing System Resource Queries with the Proxy Pattern
Scenario: Exposing System Resource Usage via API
When building APIs that expose system metrics like CPU and memory utilization, performance optimization becomes critical. This article explores how the Proxy Pattern can efficiently handle resource monitoring requests.
The Challenge
Multiple servers may simultaneously call a resource monitoring e ...
Posted on Sun, 07 Jun 2026 17:09:41 +0000 by dino345
Understanding MyBatis Caching: First-Level and Second-Level Cache Mechanisms
Introduction to Caching
Caching is a common feature in ORM frameworks, designed to enhance query performance and reduce database load by storing frequently accessed data in memory.
Cache Architecture
In the MyBatis source code, classes related to caching are located in the cache package. The core of this system is the Cache interface, with the ...
Posted on Thu, 04 Jun 2026 18:41:26 +0000 by jini01
Practical Guide to In-Memory Caching with Redis
Why caching matters
Every request that reaches the database consumes CPU, memory, and disk I/O. When traffic spikes, the database becomes the first bottleneck. A cache layer—placed between the application and the datastore—absorbs the majority of read requests, reduces latency, and acts as a circuit-breaker when the primary store is unavailable ...
Posted on Tue, 26 May 2026 18:49:24 +0000 by helpwanted
Practical Redis: Session Management, Caching, Flash Sales, and Advanced Data Structures
Stateless Authentication with RedisIn a distributed architecture, relying on Tomcat's local sessions for user state leads to inconsistencies across instances. Redis serves as a centralized session store to solve this. When a user logs in via SMS, a unique token is generated and stored in Redis as the key, with the serialized user DTO as the val ...
Posted on Thu, 21 May 2026 18:30:50 +0000 by JohnN4
MyBatis Caching: First-Level, Second-Level, and EHCache Integration
Understanding MyBatis Caching Mechanisms
MyBatis incorporates an internal caching system designed to enhance application performance by minimizing redundant database interactions. This caching operates at two distinct levels: a local, session-scoped cache and a global, application-scoped cache.
First-Level Cache: SqlSession Scope
The first-leve ...
Posted on Wed, 20 May 2026 16:32:32 +0000 by Jackount
Using Redis Caching in MyBatis Operations with Spring Boot
In the previous article, we explored Spring Boot integration with Redis. This article focuses on implementing Redis caching in MyBatis operations. We'll examine four key annotations: @CachePut, @Cacheable, @CacheEvict, and @CacheConfig.
Fundamentals
@Cacheable
The @Cacheable annotation configures method-level caching, storing results based on m ...
Posted on Wed, 20 May 2026 07:19:39 +0000 by santhosh_89
LFU Cache Algorithm Implementation Analysis
Introduction to LFU Caching
LFU (Least Frequently Used) is a caching algorithm that removes the least frequently accessed items when the cache reaches its capacity. Unlike LRU (Least Recently Used), which considers only recency, LFU prioritizes access frequency.
Comparison of LFU and LRU
Consider a cache with capacity 3 and the following access ...
Posted on Tue, 19 May 2026 20:46:03 +0000 by stylefrog
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