-
Notifications
You must be signed in to change notification settings - Fork 2
API and Caching Standards
Temp edited this page Dec 5, 2025
·
1 revision
const cache = new Map<string, { data: T; timestamp: number }>()
const CACHE_TTL = 300000 // 5 min default
function getCached(key: string): T | null
function setCached(key: string, data: T): void
export function invalidateCache(scope?: string): void
// API accepts skipCache param
export const fetch = async (id: string, skipCache = false): Promise<T>| Type | TTL |
|---|---|
| Schema/FK graph | 5 min |
| Metrics | 2 min |
| Simulation results | 5 min |
- Invalidate related caches together (FK β cascade β dependencies)
- Partial invalidation by ID when possible
- Expose invalidation functions as exports
- Retry with exponential backoff (2s, 4s, 8s) for 429/503/504
- Sequential processing with 300ms delays for batches
- Backend: parallel batches max 5-10 queries
// Mount: use cache
useEffect(() => { void loadData(false) }, [id])
// Refresh button: bypass cache
<Button onClick={() => void loadData(true)}>Refresh</Button>- Build indexes/lookups upfront before loops
- Lazy-load secondary data
- Early exit for edge cases
- Database Management
- R2 Backup Restore
- Scheduled Backups
- Table Operations
- Query Console
- Schema Designer
- Column Management
- Bulk Operations
- Job History
- Time Travel
- Read Replication
- Undo Rollback
- Foreign Key Visualizer
- ER Diagram
- Foreign Key Dependencies
- Foreign Key Navigation
- Circular Dependency Detector
- Cascade Impact Simulator
- AI Search
- FTS5 Full Text Search
- Cross Database Search
- Index Analyzer
- Database Comparison
- Database Optimization