Loading Lesson & Contentβ¦
Fetching tutorial explanations & code examples
Next.js interview questions covering rendering strategies, the App Router, and Server Comp...
import cluster from "node:cluster";
import os from "node:os";
if (cluster.isPrimary) {
const cores = os.availableParallelism();
for (let i = 0; i < cores; i++) cluster.fork(); // one worker per core
cluster.on("exit", (worker) => {
console.log(`worker ${worker.process.pid} died, restarting`);
cluster.fork(); // replace crashed workers
});
} else {
startServer(); // each worker runs the same server, sharing the port
}One Node process uses one CPU core. The cluster module forks your app into multiple proces...
SET session:abc "userdata" EX 3600 # expire in 3600 seconds (set + TTL)
EXPIRE session:abc 60 # (re)set TTL to 60 seconds
PEXPIRE session:abc 500 # in milliseconds
EXPIREAT session:abc 1735689600 # at a specific Unix timestampKeys can expire automatically after a set time β the mechanism behind caching, sessions, r...
export default async function Post({
params,
}: {
params: Promise<{ slug: string }>;
}) {
const { slug } = await params;
return <h1>Post: {slug}</h1>;
}You often need one page design that works for many items — every blog post, every pr...
You explored 4 developer recipes & mental models. Unlock all 982 lessons across 31 developer courses, AI tutoring, and full interview prep.