Implements server-side database caching with 5-minute refresh intervals to dramatically improve external calendar performance while keeping data fresh. Backend changes: - New external_calendar_cache table with ICS data storage - Smart cache logic: serves from cache if < 5min old, fetches fresh otherwise - Cache repository methods for get/update/clear operations - Migration script for cache table creation Frontend changes: - 5-minute auto-refresh interval for background updates - Manual refresh button (🔄) for each external calendar - Last updated timestamps showing when each calendar was refreshed - Centralized refresh function with proper cleanup on logout Performance improvements: - Initial load: instant from cache vs slow external HTTP requests - Background updates: fresh data without user waiting - Reduced external API calls: only when cache is stale - Scalable: handles multiple external calendars efficiently 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
14 lines
636 B
SQL
14 lines
636 B
SQL
-- Create external calendar cache table for storing ICS data
|
|
CREATE TABLE external_calendar_cache (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
external_calendar_id INTEGER NOT NULL,
|
|
ics_data TEXT NOT NULL,
|
|
cached_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
etag TEXT,
|
|
FOREIGN KEY (external_calendar_id) REFERENCES external_calendars(id) ON DELETE CASCADE,
|
|
UNIQUE(external_calendar_id)
|
|
);
|
|
|
|
-- Index for faster lookups
|
|
CREATE INDEX idx_external_calendar_cache_calendar_id ON external_calendar_cache(external_calendar_id);
|
|
CREATE INDEX idx_external_calendar_cache_cached_at ON external_calendar_cache(cached_at); |