कंटेंट पर जाएँ
TakoAPI
स्किल्स पर वापस

next-cache-components

tuanvidev द्वारा

Web & Frontend Development
358clawskills.sh द्वारा बताए गए डाउनलोड
0व्यूज़
0 लाइकइस स्किल को लाइक करने के लिए साइन इन करें
—अभी तक कोई रेटिंग नहीं
आपकी रेटिंग

संक्षिप्त

Next.js 16 Cache Components - PPR, use cache directive, cacheLife, cacheTag, updateTag.

विवरण

यह स्किल क्या करती है

Next.js 16 Cache Components enable Partial Prerendering (PPR), letting you mix static, cached, and dynamic content within a single route. The `use cache` directive marks async functions or components for caching with configurable lifetimes and tag-based invalidation, replacing the older `unstable_cache()` API and `experimental.ppr` flag.

The `use cache` directive generates cache keys automatically from function arguments and closures, removing the manual key array management that `unstable_cache` required.

इसे कब इस्तेमाल करें

  • Caching database query results with configurable TTLs
  • Building dashboards that blend static headers, cached stats, and streaming notifications
  • Invalidating specific product cache entries after an admin update
  • Migrating from unstable_cache to the use cache directive in an existing app
  • Passing user session data as props to keep cached components runtime-compliant

उदाहरण वर्कफ़्लो

इनपुट

User asks: How do I cache a product list and invalidate it when a product is updated?

एजेंट
  1. 1

    Enable cacheComponents: true in next.config.ts

  2. 2

    Add 'use cache' and cacheTag('products') to the getProducts async function

  3. 3

    Set a cache lifetime with cacheLife('hours') inside the function

  4. 4

    Call revalidateTag('products') inside a server action after the database update

आउटपुट

Product list is served from cache on subsequent requests and refreshed in the background after the next mutation

इंस्टॉलेशन

clawhub install tuanvidev/next-cache-components

CLI कमांड चलाएँ, या प्रॉम्प्ट को Claude Code, Cursor, Codex या जो भी कोडिंग एजेंट आप इस्तेमाल करते हैं उसमें पेस्ट करें।

लिंक