TinyMan/CacheToys

★ 0Forks 0C#GitHub ↗Compare

README

CacheToys

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.

Features

  • Dependency tracking for cache reads
  • Reactive invalidation support (pluggable transports, Redis transport is included)
  • Simple in-memory demo harness in Program.cs

Prerequisites

  • .NET 9 SDK installed

Build

  1. From the repository root run:
    dotnet build
    or
    dotnet build CacheToys/CacheToys.csproj

Run the demo

  1. Run the demo program:
    dotnet run --project CacheToys/CacheToys.csproj
  2. The Program.cs file contains a small harness that exercises parallel dependency-tracking behavior.

Usage

  • The project exposes ReactiveCache which wraps IMemoryCache. In the demo the ReactiveCache is registered with DI:
  • Use services.AddMemoryCache() and register ReactiveCache (see Program.cs).
  • An optional invalidation transport interface IInvalidationTransport is provided; a Redis-based implementation is included as RedisInvalidationTransport.

License

  • See repository license (if any).

Contributors

TinyMan

Issues