Naravel.Cache 0.2.0

dotnet add package Naravel.Cache --version 0.2.0
                    
NuGet\Install-Package Naravel.Cache -Version 0.2.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="Naravel.Cache" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Naravel.Cache" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Naravel.Cache" />
                    
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 Naravel.Cache --version 0.2.0
                    
#r "nuget: Naravel.Cache, 0.2.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 Naravel.Cache@0.2.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=Naravel.Cache&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Naravel.Cache&version=0.2.0
                    
Install as a Cake Tool

Naravel.Cache

NuGet Downloads .NET 10 License: MIT

Named cache stores, tagging, scoping and locks for Naravel, built on Naravel.Foundation.

Fact Detail
Install dotnet add package Naravel.Cache
Targets .NET 10
Needs Naravel.Foundation, which NuGet installs with it
Providers Naravel.Cache.Redis and Naravel.Cache.Memcached, for a cache every application instance shares

What you get

  • Named stores. The default store is memory, so it runs with no configuration; CacheManager picks another store by name at run time.
  • The everyday calls. SetAsync with a TTL, TryGetAsync, PullAsync, counters with IncrementAsync, and RememberAsync, which loads a value on a miss and stores it.
  • Scopes and tags. ForUser(userId) and Scope(...) prefix the keys, and Tags("orders").FlushAsync() clears a tag without scanning keys.
  • Locks. LockManager and BlockAsync run a callback while holding a lock; with the Redis provider the lock is shared between instances.
  • A fixed-window rate limiter and a test fake. AddNaravelRateLimiter counts attempts in a named store; CacheFake is an in-memory ICacheStore for your tests.

Quick start

using Naravel.Cache;
using Naravel.Cache.Abstractions;

builder.Services.AddNaravelCache(builder.Configuration);   // no configuration needed: the default store is "memory"
builder.Services.AddSingleton(TimeProvider.System);        // the clock the endpoint reads; a test registers its own

app.MapGet("/time", (ICacheStore cache, TimeProvider clock) =>
    cache.RememberAsync("server-time", TimeSpan.FromSeconds(30),
        () => Task.FromResult(clock.GetUtcNow().ToString("T"))));

The value stays the same for 30 seconds, then the factory runs again. Add a provider package from the list below to share one cache between several instances of the application.

Package Adds
Naravel.Cache.Redis Redis cache and distributed-lock providers
Naravel.Cache.Memcached Memcached cache and lock providers

Learn more

Part of Naravel: Laravel's names, .NET's type system. All Naravel packages share one version.

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 (6)

Showing the top 5 NuGet packages that depend on Naravel.Cache:

Package Downloads
Naravel.Cache.Redis

Redis cache and distributed-lock providers for Naravel.Cache.

Naravel.Queue.Coordination

Optional Naravel.Queue job middleware that coordinates workers through Naravel.Cache locks and rate limits: WithoutOverlapping, RateLimited and ThrottlesExceptions.

Naravel.Cache.Memcached

Memcached cache and lock providers for Naravel.Cache.

Naravel.Scheduling

Naravel task scheduling: a fluent, named schedule run by a hosted service, with overlap and one-server guards over Naravel.Cache locks.

Naravel.Broadcasting

Typed real-time broadcasting over SignalR for Naravel: IBroadcastable events, channel authorization rules, signalr/log/null drivers and a test fake, built on Naravel.Foundation and Naravel.Events.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 340 11/13/2026
0.1.1 152 11/2/2026
0.1.0 156 11/1/2026