@trieb.work/nextjs-turbo-redis-cache
Version:
Designed for speed, scalability, and optimized performance, nextjs-turbo-redis-cache is your custom cache handler for demanding production environments.
20 lines (15 loc) • 328 B
text/typescript
import { NextResponse } from 'next/server';
let counter = 0;
export async function GET() {
const data = await getCachedData();
return NextResponse.json(data);
}
async function getCachedData() {
'use cache';
counter++;
return {
counter,
timestamp: Date.now(),
message: 'Revalidated cached data',
};
}