Performance: Cache busting strategies
MEDIUM IMPACT
This affects how quickly updated resources load and how browsers cache static files, impacting page load speed and user experience.
from flask import url_for # In templates or code, use version query param url_for('static', filename='style.css', v='12345') # Or use file hash as version to bust cache automatically
app = Flask(__name__) @app.route('/static/<path:filename>') def static_files(filename): return send_from_directory('static', filename) # No cache busting, browser may load old cached files
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No cache busting (static URLs) | Minimal | 0 | Low | [X] Bad |
| Cache busting with query version | Minimal | 0 | Low | [OK] Good |
| Cache busting with file hash in filename | Minimal | 0 | Low | [OK] Good |