- Add Next.js 16 "use cache" with cacheLife profiles: seedData (1h), prices (5min), demand (5min), commodities (30min), ticker (1min), alerts (2min) - Add cacheTag for parameterized server actions - Fix MetricCard icon prop: pass rendered JSX instead of component references across the server-client boundary
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import type { NextConfig } from 'next';
|
|
|
|
const nextConfig: NextConfig = {
|
|
typedRoutes: true,
|
|
cacheComponents: true,
|
|
cacheLife: {
|
|
// Seed data (datacenters, regions) — rarely changes
|
|
seedData: {
|
|
stale: 3600, // 1 hour
|
|
revalidate: 7200, // 2 hours
|
|
expire: 86400, // 1 day
|
|
},
|
|
// Electricity prices — update frequently
|
|
prices: {
|
|
stale: 300, // 5 minutes
|
|
revalidate: 1800, // 30 minutes
|
|
expire: 3600, // 1 hour
|
|
},
|
|
// Demand / generation data — moderate frequency
|
|
demand: {
|
|
stale: 300, // 5 minutes
|
|
revalidate: 1800, // 30 minutes
|
|
expire: 3600, // 1 hour
|
|
},
|
|
// Commodity prices — update less frequently
|
|
commodities: {
|
|
stale: 1800, // 30 minutes
|
|
revalidate: 21600, // 6 hours
|
|
expire: 86400, // 1 day
|
|
},
|
|
// Ticker tape — very short cache for near-real-time feel
|
|
ticker: {
|
|
stale: 60, // 1 minute
|
|
revalidate: 300, // 5 minutes
|
|
expire: 600, // 10 minutes
|
|
},
|
|
// Alerts — short cache
|
|
alerts: {
|
|
stale: 120, // 2 minutes
|
|
revalidate: 600, // 10 minutes
|
|
expire: 1800, // 30 minutes
|
|
},
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|