release: WRNexusJS 0.7.0
This commit is contained in:
@@ -89,6 +89,8 @@ export interface CacheControlOptions {
|
||||
noCache?: boolean;
|
||||
/** stale-while-revalidate window in seconds. */
|
||||
staleWhileRevalidate?: number;
|
||||
/** stale-if-error window in seconds. */
|
||||
staleIfError?: number;
|
||||
immutable?: boolean;
|
||||
}
|
||||
|
||||
@@ -104,6 +106,9 @@ export function cacheControl(options: CacheControlOptions): string {
|
||||
if (options.staleWhileRevalidate !== undefined) {
|
||||
parts.push(`stale-while-revalidate=${Math.max(0, Math.floor(options.staleWhileRevalidate))}`);
|
||||
}
|
||||
if (options.staleIfError !== undefined) {
|
||||
parts.push(`stale-if-error=${Math.max(0, Math.floor(options.staleIfError))}`);
|
||||
}
|
||||
if (options.immutable) parts.push("immutable");
|
||||
return parts.join(", ");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user