Commit 2b650e1
committed
refactor(core)!: decompose hypercache.go into domain modules and modernize ConcurrentMap iterator
Split the monolithic hypercache.go (~950 lines removed) into focused files:
- hypercache_construct.go: backend resolution and base construction
- hypercache_io.go: Set/Get/GetOrSet/GetMultiple/Remove/Clear/List
- hypercache_eviction.go: eviction configuration, loop, and triggers
- hypercache_expiration.go: expiration routine and trigger logic
- hypercache_dist.go: distributed metrics helpers (DistMetrics, ClusterOwners, etc.)
Replace ConcurrentMap's channel-based IterBuffered() with iter.Seq2-based
All(), eliminating fan-in goroutines and per-shard channel allocations.
Update all callers in dist_memory, dist_http_server, and inmemory backends.
Upgrade hash function from inlined FNV-1a to xxhash64 (XOR-folded to 32
bits) for better avalanche and ~1-3% speedup on longer keys.
Add bench-step3.txt with benchmark results on Apple M4 Pro.
BREAKING CHANGE: IterBuffered() and Tuple type removed from ConcurrentMap;
use All() iter.Seq2[string, *Item] instead.1 parent b8732c5 commit 2b650e1
14 files changed
Lines changed: 1164 additions & 1054 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments