* Get item from embedding cache pool * @param {string} chatflowid
(chatflowid: string)
| 161 | * @param {string} chatflowid |
| 162 | */ |
| 163 | async getEmbeddingCache(chatflowid: string): Promise<Map<any, any> | undefined> { |
| 164 | if (process.env.MODE === MODE.QUEUE) { |
| 165 | if (this.redisClient) { |
| 166 | const serializedValue = await this.redisClient.get(`embeddingCache:${chatflowid}`) |
| 167 | if (serializedValue) { |
| 168 | return new Map(JSON.parse(serializedValue)) |
| 169 | } |
| 170 | } |
| 171 | } else { |
| 172 | return this.activeEmbeddingCache[chatflowid] |
| 173 | } |
| 174 | return undefined |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * Close Redis connection if applicable |