๐Ÿ“ฆ cloudflare / vinext

๐Ÿ“„ page.tsx ยท 25 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25"use cache";

import { cacheLife, cacheTag } from "next/cache";

// File-level "use cache" โ€” all exports from this file are cached.
// Uses the "seconds" profile (revalidate: 1s) so tests can verify caching
// and expiration in a short window.

export default async function UseCacheTestPage() {
  cacheLife("seconds");
  cacheTag("use-cache-test");

  const timestamp = Date.now();

  return (
    <div data-testid="use-cache-test-page">
      <h1>Use Cache Test</h1>
      <p>
        Timestamp: <span data-testid="timestamp">{timestamp}</span>
      </p>
      <p data-testid="message">This page uses the &quot;use cache&quot; directive</p>
    </div>
  );
}