Cache breakdown
Breakdown cache, the data refers to a database query must not exist, cache does not exist, directly to the database request.
Avoidance scheme
- The results of the query is empty. Add a cache
- The key must not exist to filter
Cache penetration
Cache penetration, refers to a hot spot to access the data in an instant failure, is complicated by the large centralized access, direct requests to the database.
Avoidance scheme
- Achieved by threaded locking or write queue, reading the first cache, no further database check cached
Cache avalanche
Cache avalanche, refers to the cache focus expire at a certain time period, direct requests to the database.
Avoidance scheme
- The same cache penetration, practical locking strategy
- Preheat data, updating the cache before an impending avalanche, triggered manually update the cache load, and set different expiration time
- Double the cache, a short-term caching, caching a long-term, short-term priority access cache
- Set the cache never expires