@@ -29,10 +29,7 @@ It ships with a default [histogram stats collector](./stats/stats.go) and severa
2929
3030- Thread-safe & lock‑optimized (sharded map + worker pool)
3131- High-performance (low allocations on hot paths, pooled items, serializer‑aware sizing)
32- - Multiple backends (extensible):
33- 1. [ In-memory] ( ./pkg/backend/inmemory.go )
34- 1. [ Redis] ( ./pkg/backend/redis.go )
35- 1. [ Redis Cluster] ( ./pkg/backend/redis_cluster.go )
32+ - Multiple backends (extensible): 1. [ In-memory] ( ./pkg/backend/inmemory.go ) 1. [ Redis] ( ./pkg/backend/redis.go ) 1. [ Redis Cluster] ( ./pkg/backend/redis_cluster.go )
3633- Item expiration & proactive expiration triggering (debounced/coalesced)
3734- Background or proactive (interval = 0) eviction using pluggable algorithms
3835- Manual, non-blocking eviction triggering (` TriggerEviction() ` )
@@ -178,32 +175,32 @@ if err != nil {
178175
179176### Advanced options quick reference
180177
181- | Option | Purpose |
182- | -------- | --------- |
183- | ` WithEvictionInterval ` | Periodic eviction loop; set to ` 0 ` for proactive per-write eviction. |
184- | ` WithExpirationInterval ` | Periodic scan for expired items. |
185- | ` WithExpirationTriggerBuffer ` | Buffer size for coalesced expiration trigger channel. |
186- | ` WithExpirationTriggerDebounce ` | Drop rapid-fire triggers within a window. |
187- | ` WithEvictionAlgorithm ` | Select eviction algorithm (lru, lfu, clock, cawolfu, arc* ). |
188- | ` WithEvictionShardCount ` | Number of eviction-algorithm shards (default 32; 1 disables sharding). |
189- | ` WithMaxEvictionCount ` | Cap number of items evicted per cycle. |
190- | ` WithMaxCacheSize ` | Max cumulative serialized item size (bytes). |
191- | ` WithStatsCollector ` | Choose stats collector implementation. |
192- | ` WithManagementHTTP ` | Start optional management HTTP server. |
193- | ` WithDistReplication ` | (DistMemory) Set replication factor (owners per key). |
194- | ` WithDistVirtualNodes ` | (DistMemory) Virtual nodes per physical node for consistent hashing. |
195- | ` WithDistMerkleChunkSize ` | (DistMemory) Keys per Merkle leaf chunk (power-of-two recommended). |
196- | ` WithDistMerkleAutoSync ` | (DistMemory) Interval for background Merkle sync (<=0 disables). |
197- | ` WithDistMerkleAutoSyncPeers ` | (DistMemory) Limit peers synced per auto-sync tick (0=all). |
198- | ` WithDistListKeysCap ` | (DistMemory) Cap number of keys fetched via fallback enumeration. |
199- | ` WithDistNode ` | (DistMemory) Explicit node identity (id/address). |
200- | ` WithDistSeeds ` | (DistMemory) Static seed addresses to pre-populate membership. |
201- | ` WithDistTombstoneTTL ` | (DistMemory) Retain delete tombstones for this duration before compaction (<=0 = infinite). |
202- | ` WithDistTombstoneSweep ` | (DistMemory) Interval to run tombstone compaction (<=0 disables). |
203- | ` WithDistHTTPLimits ` | (DistMemory) Body / response / timeout / concurrency caps for the dist HTTP server + auto-client. |
204- | ` WithDistHTTPAuth ` | (DistMemory) Bearer-token auth (` Token ` ) plus optional ` ServerVerify ` / ` ClientSign ` hooks. |
205-
206- * ARC is experimental (not registered by default).
178+ | Option | Purpose |
179+ | ------------------------------- | ---------------------------------------------------------------------------------------- --------- |
180+ | ` WithEvictionInterval ` | Periodic eviction loop; set to ` 0 ` for proactive per-write eviction. |
181+ | ` WithExpirationInterval ` | Periodic scan for expired items. |
182+ | ` WithExpirationTriggerBuffer ` | Buffer size for coalesced expiration trigger channel. |
183+ | ` WithExpirationTriggerDebounce ` | Drop rapid-fire triggers within a window. |
184+ | ` WithEvictionAlgorithm ` | Select eviction algorithm (lru, lfu, clock, cawolfu, arc\ * ). |
185+ | ` WithEvictionShardCount ` | Number of eviction-algorithm shards (default 32; 1 disables sharding). |
186+ | ` WithMaxEvictionCount ` | Cap number of items evicted per cycle. |
187+ | ` WithMaxCacheSize ` | Max cumulative serialized item size (bytes). |
188+ | ` WithStatsCollector ` | Choose stats collector implementation. |
189+ | ` WithManagementHTTP ` | Start optional management HTTP server. |
190+ | ` WithDistReplication ` | (DistMemory) Set replication factor (owners per key). |
191+ | ` WithDistVirtualNodes ` | (DistMemory) Virtual nodes per physical node for consistent hashing. |
192+ | ` WithDistMerkleChunkSize ` | (DistMemory) Keys per Merkle leaf chunk (power-of-two recommended). |
193+ | ` WithDistMerkleAutoSync ` | (DistMemory) Interval for background Merkle sync (<=0 disables). |
194+ | ` WithDistMerkleAutoSyncPeers ` | (DistMemory) Limit peers synced per auto-sync tick (0=all). |
195+ | ` WithDistListKeysCap ` | (DistMemory) Cap number of keys fetched via fallback enumeration. |
196+ | ` WithDistNode ` | (DistMemory) Explicit node identity (id/address). |
197+ | ` WithDistSeeds ` | (DistMemory) Static seed addresses to pre-populate membership. |
198+ | ` WithDistTombstoneTTL ` | (DistMemory) Retain delete tombstones for this duration before compaction (<=0 = infinite). |
199+ | ` WithDistTombstoneSweep ` | (DistMemory) Interval to run tombstone compaction (<=0 disables). |
200+ | ` WithDistHTTPLimits ` | (DistMemory) Body / response / timeout / concurrency caps for the dist HTTP server + auto-client. |
201+ | ` WithDistHTTPAuth ` | (DistMemory) Bearer-token auth (` Token ` ) plus optional ` ServerVerify ` / ` ClientSign ` hooks. |
202+
203+ \ * ARC is experimental (not registered by default).
207204
208205### Type-safe access (` Typed[V] ` )
209206
@@ -280,7 +277,10 @@ limits := backend.DistHTTPLimits{
280277
281278// 2) Auth: a shared bearer token covers most clusters; ServerVerify /
282279// ClientSign hooks are escape hatches for JWT, mTLS-derived
283- // identity, HMAC, etc.
280+ // identity, HMAC, etc. The hypercache-server binary uses the
281+ // ServerVerify hook to plug in an OIDC verifier
282+ // (cmd/hypercache-server/oidc.go) when HYPERCACHE_OIDC_ISSUER is
283+ // set; static-bearer logins coexist with IdP-issued JWTs.
284284auth := backend.DistHTTPAuth {Token: " shared-cluster-secret" }
285285
286286bi , _ := backend.NewDistMemory (ctx,
@@ -316,44 +316,44 @@ Replica removal cleanup (actively dropping data from nodes no longer replicas) i
316316
317317Metrics (via management or ` Metrics() ` ):
318318
319- | Metric | Description |
320- | -------- | ------------- |
321- | RebalancedKeys | Count of all rebalance-related migrations (primary changes + replica diff replications). |
322- | RebalancedPrimary | Count of primary ownership change migrations (subset of RebalancedKeys). |
323- | RebalanceBatches | Number of migration batches executed. |
324- | RebalanceThrottle | Times migration concurrency limiter saturated. |
325- | RebalanceLastNanos | Duration (ns) of last rebalance scan. |
326- | RebalancedReplicaDiff | Count of replica-only diff replications (new replicas seeded). |
327- | RebalanceReplicaDiffThrottle | Times replica-only diff processing hit per-tick cap. |
319+ | Metric | Description |
320+ | ---------------------------- | --------------------------------------------------------------------------- ------------- |
321+ | RebalancedKeys | Count of all rebalance-related migrations (primary changes + replica diff replications). |
322+ | RebalancedPrimary | Count of primary ownership change migrations (subset of RebalancedKeys). |
323+ | RebalanceBatches | Number of migration batches executed. |
324+ | RebalanceThrottle | Times migration concurrency limiter saturated. |
325+ | RebalanceLastNanos | Duration (ns) of last rebalance scan. |
326+ | RebalancedReplicaDiff | Count of replica-only diff replications (new replicas seeded). |
327+ | RebalanceReplicaDiffThrottle | Times replica-only diff processing hit per-tick cap. |
328328
329329Test helpers ` AddPeer ` and ` RemovePeer ` simulate join / leave events that trigger redistribution in integration tests (` dist_rebalance_*.go ` ).
330330
331331### Roadmap / PRD Progress Snapshot
332332
333- | Area | Status |
334- | ------ | -------- |
335- | Core in-process sharding | Done |
336- | Replication fan-out | Done |
337- | Read-repair | Done |
338- | Quorum consistency (R/W) | Done |
339- | Hinted handoff (TTL, replay, caps) | Done |
340- | Tombstones (TTL + compaction) | Done |
341- | Merkle anti-entropy (pull) | Done |
342- | Merkle phase metrics | Done |
343- | Auto Merkle background sync | Done |
333+ | Area | Status |
334+ | ------------------------------------------------------------------ | ------------------------------------------------- -------- |
335+ | Core in-process sharding | Done |
336+ | Replication fan-out | Done |
337+ | Read-repair | Done |
338+ | Quorum consistency (R/W) | Done |
339+ | Hinted handoff (TTL, replay, caps) | Done |
340+ | Tombstones (TTL + compaction) | Done |
341+ | Merkle anti-entropy (pull) | Done |
342+ | Merkle phase metrics | Done |
343+ | Auto Merkle background sync | Done |
344344| Rebalancing (primary/lost ownership + replica-add diff + shedding) | Partial (shedding grace delete added; future retry/queue) |
345- | Failure detection (heartbeat) | Partial (basic) |
346- | Lightweight gossip snapshot | Partial |
347- | Replica-only migration diff | Planned |
348- | Adaptive Merkle scheduling | Planned |
349- | Advanced versioning (HLC/vector) | Planned |
350- | Client SDK (direct routing) | Planned |
351- | Tracing spans | Planned |
352- | Security (TLS/auth) | Done (since v0.5.0; see "Transport hardening") |
353- | Compression | Planned |
354- | Persistence | Out of scope (current phase) |
355- | Chaos / fault injection | Planned |
356- | Benchmarks & tests | Ongoing (broad coverage) |
345+ | Failure detection (heartbeat) | Partial (basic) |
346+ | Lightweight gossip snapshot | Partial |
347+ | Replica-only migration diff | Planned |
348+ | Adaptive Merkle scheduling | Planned |
349+ | Advanced versioning (HLC/vector) | Planned |
350+ | Client SDK (direct routing) | Planned |
351+ | Tracing spans | Planned |
352+ | Security (TLS/auth) | Done (since v0.5.0; see "Transport hardening") |
353+ | Compression | Planned |
354+ | Persistence | Out of scope (current phase) |
355+ | Chaos / fault injection | Planned |
356+ | Benchmarks & tests | Ongoing (broad coverage) |
357357
358358Example minimal setup:
359359
@@ -433,4 +433,4 @@ I'm a surfer, and a software architect with 15 years of experience designing hig
433433[ ![ LinkedIn] ( https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white )] ( https://www.linkedin.com/in/francesco-cosentino/ )
434434
435435[ build-link ] : https://github.com/hyp3rd/hypercache/actions/workflows/go.yml
436- [ codeql-link ] :https://github.com/hyp3rd/hypercache/actions/workflows/codeql.yml
436+ [ codeql-link ] : https://github.com/hyp3rd/hypercache/actions/workflows/codeql.yml
0 commit comments