| 189 | } |
| 190 | |
| 191 | override async onMutate(params: MutationOption) { |
| 192 | const tags = Array.isArray(params.tags) ? params.tags : params.tags ? [params.tags] : []; |
| 193 | const tables = Array.isArray(params.tables) ? params.tables : params.tables ? [params.tables] : []; |
| 194 | const tableNames: string[] = tables.map((table) => is(table, Table) ? table[OriginalName] : table as string); |
| 195 | |
| 196 | const compositeTableSets = tableNames.map((table) => this.addTablePrefix(table)); |
| 197 | await this.luaScripts.onMutateScript.exec([UpstashCache.tagsMapKey, ...compositeTableSets], tags); |
| 198 | } |
| 199 | |
| 200 | private addTablePrefix = (table: string) => `${UpstashCache.compositeTableSetPrefix}${table}`; |
| 201 | private getCompositeKey = (tables: string[]) => `${UpstashCache.compositeTablePrefix}${tables.sort().join(',')}`; |