mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-28 05:25:33 +00:00
feat: Use LRUCache instead of Map in MemoryCache (#774)
This commit is contained in:
parent
bc9120f751
commit
239fc123b9
2 changed files with 3 additions and 1 deletions
|
|
@ -14,6 +14,7 @@
|
|||
"@ai-sdk/anthropic": "^2.0.25",
|
||||
"@ai-sdk/openai": "^2.0.23",
|
||||
"ai": "^5.0.29",
|
||||
"lru-cache": "^11.2.6",
|
||||
"openai": "^4.104.0",
|
||||
"supermemory": "^3.0.0-alpha.26",
|
||||
"zod": "^4.1.5"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { LRUCache } from "lru-cache"
|
||||
import type { MemoryMode } from "./types"
|
||||
|
||||
/**
|
||||
|
|
@ -5,7 +6,7 @@ import type { MemoryMode } from "./types"
|
|||
* Used to cache memory retrieval results during tool-call loops within the same turn.
|
||||
*/
|
||||
export class MemoryCache<T = string> {
|
||||
private cache: Map<string, T> = new Map()
|
||||
private cache: LRUCache<string, T> = new LRUCache({ max: 100 })
|
||||
|
||||
/**
|
||||
* Generates a cache key for the current turn based on context parameters.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue