* Get item from llm cache pool * @param {string} chatflowid
(chatflowid: string)
| 143 | * @param {string} chatflowid |
| 144 | */ |
| 145 | async getLLMCache(chatflowid: string): Promise<Map<any, any> | undefined> { |
| 146 | if (process.env.MODE === MODE.QUEUE) { |
| 147 | if (this.redisClient) { |
| 148 | const serializedValue = await this.redisClient.get(`llmCache:${chatflowid}`) |
| 149 | if (serializedValue) { |
| 150 | return new Map(JSON.parse(serializedValue)) |
| 151 | } |
| 152 | } |
| 153 | } else { |
| 154 | return this.activeLLMCache[chatflowid] |
| 155 | } |
| 156 | return undefined |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Get item from embedding cache pool |