๐ค๏ธ Weather - Data Strategies Demo
๐ Choose Your Demo
This application demonstrates three different data fetching strategies. Click below to see each approach:
๐ Strategy Comparison
Aspect | Page Cache | Controller Cache | Real-Time |
---|---|---|---|
What's Cached | Entire page HTML | API response only | Nothing |
Page Render | Constant (cached) | Fresh each time | Initial + real-time |
API Response | Constant (cached) | Constant (cached) | Continuous updates |
Performance | Highest | Medium | Real-time |
Best For | Static content | Dynamic layouts | Live dashboards |
๐งช How to Test
Each demo page includes timing information and a "Test Cache" button. Here's what to expect:
๐ Page Cache Demo
Expected: Both page render time AND API response time stay identical on refresh
Test Button: Refreshes page, but cached HTML is still served (same timestamps)
๐ฏ Controller Cache Demo
Expected: Page render time changes, API response time stays the same
Test Button: Shows new page render time but same API response time
โก Real-Time Demo
Expected: Continuous updates every 2 seconds via SignalR
Test Button: Requests immediate update (bypasses any caching)
โฑ๏ธ About the 5-Second Delay
The Weather API includes an artificial 5-second delay to simulate slow database queries. This makes caching benefits clearly visible:
First request: ~5 seconds | Cached requests: Instant (within 60 seconds)