| 125 | } |
| 126 | |
| 127 | override async get( |
| 128 | key: string, |
| 129 | tables: string[], |
| 130 | isTag: boolean = false, |
| 131 | isAutoInvalidate?: boolean, |
| 132 | ): Promise<any[] | undefined> { |
| 133 | if (!isAutoInvalidate) { |
| 134 | const result = await this.redis.hget(UpstashCache.nonAutoInvalidateTablePrefix, key); |
| 135 | return result === null ? undefined : result as any[]; |
| 136 | } |
| 137 | |
| 138 | if (isTag) { |
| 139 | const result = await this.luaScripts.getByTagScript.exec([UpstashCache.tagsMapKey], [key]); |
| 140 | return result === null ? undefined : result as any[]; |
| 141 | } |
| 142 | |
| 143 | // Normal cache lookup for the composite key |
| 144 | const compositeKey = this.getCompositeKey(tables); |
| 145 | const result = await this.redis.hget(compositeKey, key) ?? undefined; // Retrieve result for normal query |
| 146 | return result === null ? undefined : result as any[]; |
| 147 | } |
| 148 | |
| 149 | override async put( |
| 150 | key: string, |