CacheToys is a small .NET 9 sample library and demo showing a reactive, dependency-tracking cache built on top of IMemoryCache. It includes an example program that demonstrates how dependent cache entries are tracked when multiple tasks interact with the cache concurrently.
- Dependency tracking for cache reads
- Reactive invalidation support (pluggable transports, Redis transport is included)
- Simple in-memory demo harness in
Program.cs
- .NET 9 SDK installed
- From the repository root run:
or
dotnet build
dotnet build CacheToys/CacheToys.csproj
- Run the demo program:
dotnet run --project CacheToys/CacheToys.csproj
- The
Program.csfile contains a small harness that exercises parallel dependency-tracking behavior.
- The project exposes
ReactiveCachewhich wrapsIMemoryCache. In the demo theReactiveCacheis registered with DI: - Use
services.AddMemoryCache()and registerReactiveCache(seeProgram.cs). - An optional invalidation transport interface
IInvalidationTransportis provided; a Redis-based implementation is included asRedisInvalidationTransport.
- See repository license (if any).