Belljar 1.0.0

dotnet add package Belljar --version 1.0.0
                    
NuGet\Install-Package Belljar -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Belljar" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Belljar" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Belljar" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Belljar --version 1.0.0
                    
#r "nuget: Belljar, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Belljar@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Belljar&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Belljar&version=1.0.0
                    
Install as a Cake Tool

belljar.net 🫙

Conditional, mid-execution memoization for complex runtime state.

Standard tools (like IMemoryCache or PostSharp) check the cache before execution, failing completely when your logic relies on mutable state (like advancing database cursors, API paginators, or stream readers).

belljar lets you check the cache during execution.

By calling include(), you continuously update a cryptographic hash with runtime variables. If belljar detects that this specific state sequence has been processed before, execution stops immediately and the cached result is returned.

The Showcase

No boilerplate. No interfaces. No partial classes. Just an attribute and your native code.

using System.Threading.Tasks;
using Belljar;

public class LogParser
{
    @Store(".jar/logs") // Caches to disk automatically
    public async Task<string> ParseAsync(FileHandle file)
    {
        // 1. Add standard arguments to the hash
        belljar.include(file.FileName);

        // 2. Add dynamic runtime state (e.g., current cursor position)
        belljar.include(file.Position);

        // CHECKPOINT:
        // If we've processed this exact file at this exact cursor position before,
        // execution STOPS here. The IL Weaver catches the signal, safely unrolls
        // the Task state machine, and returns the JSON payload from disk.
        belljar.check();

        Console.WriteLine("Heavy processing...");
        await Task.Delay(1000);
        return file.ReadChunk();
    }
}

How It Beats Standard Caching

Feature Standard Memoization (MemoryCache / AOP) belljar
Identity Static function arguments. Dynamic runtime state + Compiled source code.
Execution Checks cache before method starts. Checks cache exactly when you tell it to.
Mutability Returns wrong/stale data if internal state changed. Safely hashes mutable cursors mid-flight.
Ergonomics Heavy boilerplate, DI injection, wrapper methods. One attribute ([Store]). Pure domain logic.

Features

  • Mid-Execution Cache Hits: Skip the heavy lifting by bailing out of a function halfway through if the intermediate state is recognized.
  • IL-Bytecode Auto-Invalidation: belljar hashes the actual compiled Intermediate Language (IL) of your method. If you change your code and recompile, the cache automatically invalidates.
  • True Async/Await Support: Safely hijacks Task<T> and ValueTask<T> state machines across background threads without exploding the call stack.
  • Topological Nesting: Infinite recursion support. Method A can miss while its nested Method B hits; belljar maintains perfect stack isolation.
  • Atomic Persistence: Thread-safe disk caching prevents corrupted JSON reads, even when hundreds of parallel requests hit the exact same state simultaneously.

Installation

Powered by compile-time IL Weaving.

dotnet add package Belljar

(Note: Requires the .NET SDK. Powered mechanically by Rougamo IL injection).

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 153 4/5/2026