()
| 398 | } |
| 399 | |
| 400 | func (c *ToolCache) cleanup() { |
| 401 | c.stats.LastCleanupAt = time.Now() |
| 402 | |
| 403 | // 清理内存缓存 |
| 404 | if c.config.Strategy == CacheStrategyMemory || c.config.Strategy == CacheStrategyBoth { |
| 405 | c.cleanupMemory() |
| 406 | } |
| 407 | |
| 408 | // 清理文件缓存 |
| 409 | if c.config.Strategy == CacheStrategyFile || c.config.Strategy == CacheStrategyBoth { |
| 410 | c.cleanupFiles() |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | func (c *ToolCache) cleanupMemory() { |
| 415 | c.memoryMu.Lock() |