mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-22 18:43:29 +00:00
Cache API spec for 24 hours, revalidated every 2 hours (#2792)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Cache API spec for 24 hours, revalidated every 2 hours
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
OpenAPIParseError,
|
||||
} from '@gitbook/react-openapi';
|
||||
|
||||
import { cache, parseCacheResponse, noCacheFetchOptions, CacheFunctionOptions } from '@/lib/cache';
|
||||
import { cache, noCacheFetchOptions, CacheFunctionOptions } from '@/lib/cache';
|
||||
|
||||
import { parseMarkdown } from './markdown';
|
||||
import { ResolvedContentRef } from './references';
|
||||
@@ -68,7 +68,10 @@ const fetcher: OpenAPIFetcher = {
|
||||
const text = await response.text();
|
||||
const data = await parseOpenAPI({ url, value: text, parseMarkdown });
|
||||
return {
|
||||
...parseCacheResponse(response),
|
||||
// Cache for 4 hours
|
||||
ttl: 24 * 60 * 60,
|
||||
// Revalidate every 2 hours
|
||||
revalidateBefore: 22 * 60 * 60,
|
||||
data,
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user