mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-19 09:06:03 +00:00
7a87cc1bb1
* Implement a tagging logic for cache value * Extract cache-tags from HTTP requests * Auto-tag API cache entry * Implement route * Output cache-control and cache-tag * Make the revalidate route a edge one
19 lines
624 B
Markdown
19 lines
624 B
Markdown
# Caching
|
|
|
|
## Invalidate the cache
|
|
|
|
Invalidate cache can be done at two levels using tags:
|
|
|
|
- Data fetching cache
|
|
- Rendering cache
|
|
|
|
To invalidate the data fetching cache, you can execute a POST request to `/.revalidate`:
|
|
|
|
```bash
|
|
curl --location --request POST 'https://gitbook/mycompany.com/.revalidate' \
|
|
--header 'Content-Type: application/json' \
|
|
--data-raw '{"tags": ["space.id"]}'
|
|
```
|
|
|
|
To invalidate the rendering cache, the implementation mainly depends on the infrastructure serving the content, GitBook outputs a `Cache-Tag` header on every requests. The value of the header is a comma separated list of tags.
|