프로젝트
GitHub에서 보기
jjenzz/pretty-cache-header
소개
사람이 읽기 쉬운 시간 문자열을 초 단위로 파싱하는 Cache-Control 헤더 유틸리티입니다.
기타 프로젝트측정된 스타 증가
- in 24h
- 0
- in 7 days
- -1
- in 15 days
- -1
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalpretty-cache-header
Cache-control header utility that parses human readable time strings into seconds.
Time based values use Template Literal Types to help avoid passing invalid time string formats.
Installation
npm i pretty-cache-header
Usage
import { cacheHeader } from 'pretty-cache-header';
return new Response(..., {
headers: {
// sets cache control header to "public, max-age=604800, stale-while-revalidate=31536000"
'Cache-Control': cacheHeader({
public: true,
maxAge: '1week',
staleWhileRevalidate: '1year'
})
}
})
TimeString format
Any number followed by a timestring keyword:
ms,milli,millisecond,milliseconds- will parse to millisecondss,sec,secs,second,seconds- will parse to secondsm,min,mins,minute,minutes- will parse to minutesh,hr,hrs,hour,hours- will parse to hoursd,day,days- will parse to daysw,week,weeks- will parse to weeksmon,mth,mths,month,months- will parse to monthsy,yr,yrs,year,years- will parse to years
관련 프로젝트 살펴보기
불러오는 중…