next.js/test/e2e/app-dir/use-cache/node_modules/my-pkg/index.js
index.js24 lines485 B
import { cacheLife, cacheTag } from 'next/cache'

export async function getCachedRandom() {
  'use cache'
  return Math.random()
}

export async function getCachedRandomWithTag(tag) {
  'use cache'
  cacheTag(tag)
  return Math.random()
}

export async function getCachedRandomWithCacheLife(n = 1) {
  'use cache'
  cacheLife('weeks')
  return String(Math.ceil(Math.random() * n))
}

export async function getCachedRandomWithHandler() {
  'use cache: default'
  return Math.random()
}
Quest for Codev2.0.0
/
SIGN IN