Path: redb/redb.Core/Caching/CachePublication.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Core/Caching/CachePublication.cs ---- using System; using redb.Core.Data; namespace redb.Core.Caching { /// /// The caches publish committed state only (review after 4.0.0). A cache Set marks the graph shared, and a shared /// instance does not keep what one transaction saw (owner decision 2026-09-15) - so a Set inside a transaction made /// the writer's own loaded object forget its lazy references: an edit of root.Props.Next.Props followed by a /// save of root.Props.Next saved a fresh reload, and every read of a list item's object was a query. A Set /// inside a transaction now waits for its commit; until then the instance is the reader's own, and what a /// rolled-back transaction loaded never reaches the cache. /// public static class CachePublication { /// /// Runs now, or once the transaction takes part in has /// committed - the explicit redb transaction of the context, else the ambient . /// public static void AfterCommit(IRedbContext context, Action publish) { ArgumentNullException.ThrowIfNull(context); ArgumentNullException.ThrowIfNull(publish); if (!TransactionHooks.OnCompleted(context, committed => { if (committed) publish(); })) publish(); } } }