Performance: Redis as cache provider
HIGH IMPACT
This affects page load speed by reducing backend response time and lowering server load through fast data retrieval.
public String getData(String key) {
String cached = redis.get(key);
if (cached != null) return cached;
String data = database.query(key);
redis.set(key, data);
return data;
}public String getData(String key) {
// No caching, always fetch from database
return database.query(key);
}| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No cache, direct DB calls | N/A | N/A | High backend delay delays paint | [X] Bad |
| Redis cache for frequent data | N/A | N/A | Fast backend response speeds paint | [OK] Good |