mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-24 07:00:40 +03:00
Feature/Add bullmq redis for message queue processing (#3568)
* add bullmq redis for message queue processing * Update pnpm-lock.yaml * update queue manager * remove singleton patterns, add redis to cache pool * add bull board ui * update rate limit handler * update redis configuration * Merge add rate limit redis prefix * update rate limit queue events * update preview loader to queue * refractor namings to constants * update env variable for queue * update worker shutdown gracefully
This commit is contained in:
@@ -27,17 +27,17 @@ class InMemoryCache implements INode {
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const memoryMap = options.cachePool.getLLMCache(options.chatflowid) ?? new Map()
|
||||
const memoryMap = (await options.cachePool.getLLMCache(options.chatflowid)) ?? new Map()
|
||||
const inMemCache = new InMemoryCacheExtended(memoryMap)
|
||||
|
||||
inMemCache.lookup = async (prompt: string, llmKey: string): Promise<any | null> => {
|
||||
const memory = options.cachePool.getLLMCache(options.chatflowid) ?? inMemCache.cache
|
||||
const memory = (await options.cachePool.getLLMCache(options.chatflowid)) ?? inMemCache.cache
|
||||
return Promise.resolve(memory.get(getCacheKey(prompt, llmKey)) ?? null)
|
||||
}
|
||||
|
||||
inMemCache.update = async (prompt: string, llmKey: string, value: any): Promise<void> => {
|
||||
inMemCache.cache.set(getCacheKey(prompt, llmKey), value)
|
||||
options.cachePool.addLLMCache(options.chatflowid, inMemCache.cache)
|
||||
await options.cachePool.addLLMCache(options.chatflowid, inMemCache.cache)
|
||||
}
|
||||
return inMemCache
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user