File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
packages/cloudflare/src/api Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,21 @@ class Cache implements IncrementalCache {
6262 } ;
6363 }
6464 }
65+
66+ const entryValue = entry ?. value as Record < string , unknown > ;
67+ if ( entryValue . kind === "FETCH" ) {
68+ const data = ( entryValue . data as Record < string , string > | undefined ) ?. headers as
69+ | Record < string , string >
70+ | undefined ;
71+ const expires = data ?. expires ;
72+ const expiresTime = new Date ( expires as string ) . getTime ( ) ;
73+ if ( ! isNaN ( expiresTime ) && expiresTime <= new Date ( ) . getTime ( ) ) {
74+ this . debug ( entry ? `-> hit` : `-> miss` ) ;
75+ // the entry is expired, so let's ignore it
76+ entry = null ;
77+ }
78+ }
79+
6580 this . debug ( entry ? `-> hit` : `-> miss` ) ;
6681 return { value : entry ?. value , lastModified : entry ?. lastModified } ;
6782 } catch {
You can’t perform that action at this time.
0 commit comments