-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Overview
Configure proper HTTP caching for performance.
Parent Epic: #70
Priority: P2
Prerequisites
- 3.1: Create Stories Controller with RSC Rendering #78 (3.1: Create Stories Controller with RSC Rendering)
- 3.2: Create Items Controller (Story Detail) #79 (3.2: Create Items Controller)
Next Issues (after this is complete)
- 7.4: Add Production Configuration
Acceptance Criteria
- Story list pages: Cache-Control with 1 minute max-age
- Individual story pages: Cache-Control with 5 minute max-age
- User pages: Cache-Control with 10 minute max-age
- Proper Vary headers for content negotiation
- ETag support for conditional requests (304 responses)
- Verify caching works with curl/DevTools
Implementation Notes
# In controllers
class StoriesController < ApplicationController
def index
expires_in 1.minute, public: true
# ...
end
end
class ItemsController < ApplicationController
def show
@item = HackerNewsClient.fetch_item(params[:id])
fresh_when(@item, public: true)
expires_in 5.minutes, public: true
# ...
end
endConsider using stale? for conditional GET support.
coderabbitai