File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
packages/cloudflare/src/api Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,18 @@ import { getCloudflareContext } from "./cloudflare-context.js";
77// inlined during build
88const manifest = process . env . __OPENNEXT_CACHE_TAGS_MANIFEST ;
99
10+ /**
11+ * An instance of the Tag Cache that uses a D1 binding (`NEXT_CACHE_D1`) as it's underlying data store.
12+ *
13+ * The table used defaults to `tags`, but can be configured with the `NEXT_CACHE_D1_TABLE`
14+ * environment variable.
15+ *
16+ * There should be three columns created in the table; `tag`, `path`, and `revalidatedAt`.
17+ *
18+ * A combination of the D1 entries and the build-time tags manifest is used.
19+ */
1020class D1TagCache implements TagCache {
11- public name = "d1-tag-cache" ;
21+ public readonly name = "d1-tag-cache" ;
1222
1323 public async getByPath ( rawPath : string ) : Promise < string [ ] > {
1424 const { isDisabled, db, table } = this . getConfig ( ) ;
@@ -141,10 +151,10 @@ class D1TagCache implements TagCache {
141151 const set = new Set < string > ( ) ;
142152
143153 for ( const arr of arrays ) {
144- arr ?. forEach ( ( v ) => set . add ( this . removeBuildId ( v ) ) ) ;
154+ arr ?. forEach ( ( v ) => set . add ( v ) ) ;
145155 }
146156
147- return [ ...set . values ( ) ] ;
157+ return [ ...set . values ( ) ] . map ( ( v ) => this . removeBuildId ( v ) ) ;
148158 }
149159}
150160
You can’t perform that action at this time.
0 commit comments