Weather - Data Strategies Demo
Login Register

๐ŸŒค๏ธ 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)

An unhandled error has occurred. Reload ??