Cache Rules
A cache rule lets you change how caching works for certain pages. Most of the time nsin’s default caching is great, but sometimes you want extra control — for example, to never cache a private page, or to cache something for longer.
When to use a cache rule
Section titled “When to use a cache rule”- A page shows personal or live data and should never be cached (like a cart or account page).
- A file rarely changes and you want nsin to keep it cached for a long time.
- You want to bypass the cache for a section of your site while you test changes.
Create a cache rule
Section titled “Create a cache rule”- Go to Rules → Add Rule → Cache Rule.
- Set the When (which addresses it applies to). For example:
/accountto match your account pages.
- Choose the caching behavior:
- Bypass cache — never store a copy; always ask your server.
- Cache — store a copy (you can set how long to keep it).
- Save.
Should I cache it or bypass it?
Section titled “Should I cache it or bypass it?”| If the page… | Do this |
|---|---|
| Shows the same thing to everyone (a blog post, an image) | Cache it |
| Shows different things per person (account, cart, dashboard) | Bypass the cache |
| Changes very often (live scores, stock) | Bypass or use a short cache time |
Let your server decide (advanced)
Section titled “Let your server decide (advanced)”By default, nsin uses its own smart caching and ignores the cache instructions your server sends. If you know what you’re doing and want nsin to follow your server’s cache instructions instead, you can turn on the “respect origin headers” option for the rule. Leave it off if you’re not sure — the default works well for most sites.
Common questions
Section titled “Common questions”My private page got cached and showed the wrong data. Add a cache rule that bypasses the cache for that page, then purge the cache once.
I want a file to load instantly forever. Add a cache rule that caches it for a long time. If you later change that file, remember to purge it.