AI Integration
AI Agents & Context
Help AI assistants understand and implement cached-middleware-fetch-next effectively with our comprehensive context files.
What is llms.txt?
The llms.txt file is a standardized way to provide LLM-friendly information about a project.
Our llms.txt files contain a concise overview of what cached-middleware-fetch-next does, links to key documentation sections, and essential information for understanding the API and usage patterns.
What's included:
- • Complete API reference and usage examples
- • GraphQL caching patterns and best practices
- • SWR implementation details and cache behavior
- • Performance optimization strategies
- • Error handling and troubleshooting guides
Quick Access
Direct links to our AI context files for immediate use
Main file:
llms.txtFull context:
llms-full.txtExample Prompt
Copy this prompt to help AI assistants implement the library effectively
Read the cached-middleware-fetch-next documentation from: https://cached-middleware-fetch-next.dev/llms-full.txt I need to implement cached-middleware-fetch-next in my Next.js application. I want to: 1. Set up caching for API calls in my middleware.ts 2. Pick sensible defaults for the next.revalidate value based on the nature of the data being fetched 3. Do not use the cachedFetch() for data which should never be cached 4. Target your changes only to middleware, do not replace fetch implementations outside of middleware 5. This caching will only work when deployed to Vercel; it won't work on other hosting environments, or in local dev. Consider adding comments or logging as appropriate in order to inform the user when the cache is ineffective
Integration Tips
Best practices for AI-assisted implementation
For AI Assistants:
- • Always suggest using cachedFetch as a drop-in replacement for fetch in middleware
- • Recommend appropriate cache strategies based on data freshness requirements
- • For GraphQL APIs, highlight the automatic query-based cache key generation
- • Suggest using cache tags for related data that might need coordinated invalidation
- • Explain the SWR behavior and when stale data is acceptable
- • Recommend monitoring cache status headers for debugging and optimization
Example Integration Advice:
"For API data that changes infrequently, use next: { revalidate: 3600 }
for 1-hour caching. For user-specific data, consider shorter revalidation times like 300 seconds. Always check the x-cache-status header during development to verify caching behavior."