Skip to content

V4 - #23

Merged
unkn0wn-root merged 10 commits into
mainfrom
v4
Aug 24, 2026
Merged

V4#23
unkn0wn-root merged 10 commits into
mainfrom
v4

Conversation

@unkn0wn-root

@unkn0wn-root unkn0wn-root commented Aug 24, 2026

Copy link
Copy Markdown
Owner

This PR introduces CASCache v4 and replaces the v3 implementation with a smaller API built around typed caches, snapshots, explicit backends, and invalidation fences.

The main read path is now Cache.Load. Concurrent misses for the same key share one loader call. Caller cancellation, loader timeouts, panic recovery, and invalidation during an active load are handled without returning a value that can no longer be confirmed as current.

Main changes

  • Move the module to github.com/unkn0wn-root/cascache/v4.
  • Add local, Redis, and shared Redis backends behind one backend interface.
  • Add snapshot-based conditional writes with clear stored, conflict, rejected, and disabled outcomes.
  • Add a standalone invalidator for services that do not need the cached value type.
  • Add typed keys, TTL jitter, metrics callbacks, and observer hooks.
  • Reject known Redis replica-read configurations because replication lag can return stale values with matching fences.
  • Add backend conformance tests and provider tests.
  • Add local and Redis benchmarks for reads, sets, and invalidation.
  • Rewrite the README and examples around the v4 API.

Breaking changes

  • Imports must use the /v4 module path.
  • The old batch, read-guard, version-store, and Redis APIs have been removed.
  • Storage keys now use the cas:v4 prefix and entries use wire format version 4. Existing v3 cache entries are not reused.
  • Backends, stores, and Redis clients remain owned and closed by the caller.

@unkn0wn-root unkn0wn-root self-assigned this Aug 24, 2026
@unkn0wn-root
unkn0wn-root marked this pull request as ready for review August 24, 2026 12:51
@unkn0wn-root
unkn0wn-root merged commit 0378565 into main Aug 24, 2026
8 checks passed
@unkn0wn-root
unkn0wn-root deleted the v4 branch August 24, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant