Commit 3ae8721
committed
feat(cache): replace LruCache and TtlCache with unified Cache
Introduces a single `Cache` class that subsumes both `LruCache` and
`TtlCache` into a configuration-driven API (maxSize, ttl, sliding
expiration, stale-while-revalidate refresh, and onRemove). The new
implementation delegates expiration tracking to `IndexedHeap` from
`@std/data-structures/unstable-indexed-heap` for O(log n) evictions.
- Add cache/cache.ts and cache/cache_test.ts
- Remove cache/lru_cache.ts, cache/ttl_cache.ts and their tests
- Update cache/memoize.ts doc to reference Cache
- Update cache/mod.ts and cache/deno.json exports
Made-with: Cursor1 parent f318978 commit 3ae8721
10 files changed
Lines changed: 3283 additions & 1582 deletions
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 6 | + | |
| 7 | + | |
9 | 8 | | |
10 | 9 | | |
This file was deleted.
0 commit comments