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";
7
7
// inlined during build
8
8
const manifest = process . env . __OPENNEXT_CACHE_TAGS_MANIFEST ;
9
9
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
+ */
10
20
class D1TagCache implements TagCache {
11
- public name = "d1-tag-cache" ;
21
+ public readonly name = "d1-tag-cache" ;
12
22
13
23
public async getByPath ( rawPath : string ) : Promise < string [ ] > {
14
24
const { isDisabled, db, table } = this . getConfig ( ) ;
@@ -141,10 +151,10 @@ class D1TagCache implements TagCache {
141
151
const set = new Set < string > ( ) ;
142
152
143
153
for ( const arr of arrays ) {
144
- arr ?. forEach ( ( v ) => set . add ( this . removeBuildId ( v ) ) ) ;
154
+ arr ?. forEach ( ( v ) => set . add ( v ) ) ;
145
155
}
146
156
147
- return [ ...set . values ( ) ] ;
157
+ return [ ...set . values ( ) ] . map ( ( v ) => this . removeBuildId ( v ) ) ;
148
158
}
149
159
}
150
160
You can’t perform that action at this time.
0 commit comments