* 从缓存获取查询结果
(cacheKey: string)
| 655 | * 从缓存获取查询结果 |
| 656 | */ |
| 657 | private getFromCache(cacheKey: string): readonly Entity[] | null { |
| 658 | const entry = this._queryCache.get(cacheKey); |
| 659 | if (!entry) return null; |
| 660 | |
| 661 | // 检查缓存是否过期或版本过期 |
| 662 | if (Date.now() - entry.timestamp > this._cacheTimeout || entry.version !== this._version) { |
| 663 | this._queryCache.delete(cacheKey); |
| 664 | return null; |
| 665 | } |
| 666 | |
| 667 | entry.hitCount++; |
| 668 | return entry.entities; |
| 669 | } |
| 670 | |
| 671 | /** |
| 672 | * 添加查询结果到缓存 |
no test coverage detected