next.js/test/e2e/app-dir/app-static/pages/unstable-cache-edge.js
unstable-cache-edge.js30 lines480 B
import { unstable_cache } from 'next/cache'

export const config = {
  runtime: 'experimental-edge',
}

export async function getServerSideProps() {
  const data = await unstable_cache(async () => {
    return {
      random: Math.random(),
    }
  })()

  return {
    props: {
      now: Date.now(),
      data,
    },
  }
}

export default function Page(props) {
  return (
    <>
      <p>/unstable-cache-edge</p>
      <p id="props">{JSON.stringify(props)}</p>
    </>
  )
}
Quest for Codev2.0.0
/
SIGN IN