CacheLens.AspNetCore
0.1.0
dotnet add package CacheLens.AspNetCore --version 0.1.0
NuGet\Install-Package CacheLens.AspNetCore -Version 0.1.0
<PackageReference Include="CacheLens.AspNetCore" Version="0.1.0" />
<PackageVersion Include="CacheLens.AspNetCore" Version="0.1.0" />
<PackageReference Include="CacheLens.AspNetCore" />
paket add CacheLens.AspNetCore --version 0.1.0
#r "nuget: CacheLens.AspNetCore, 0.1.0"
#:package CacheLens.AspNetCore@0.1.0
#addin nuget:?package=CacheLens.AspNetCore&version=0.1.0
#tool nuget:?package=CacheLens.AspNetCore&version=0.1.0
CacheLens
Runtime visibility for ASP.NET Core IMemoryCache.
Browse cached keys, inspect values, and track expiration and hit counts — live, from inside VS Code, without changing a single line of your caching code.
This package is one half of CacheLens. It instruments your application; the CacheLens VS Code extension displays what it finds. You need both.
Install
dotnet add package CacheLens.AspNetCore
Then install the CacheLens extension in VS Code.
Use
Two lines in Program.cs:
using CacheLens.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
if (builder.Environment.IsDevelopment())
{
builder.Services.AddCacheLens();
}
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.MapCacheLens();
}
app.Run();
Run your app. It appears in the CacheLens panel within a few seconds — there is no host, port, or token to configure anywhere.
Your existing Set / Get / GetOrCreate calls stay exactly as they are. CacheLens wraps
whatever IMemoryCache you already registered, from the outside.
Why the IsDevelopment() checks
CacheLens exposes the contents of your cache, which may include real customer data. Those checks keep it out of production. Please keep them.
The endpoint fails closed by default:
| Control | Behaviour |
|---|---|
| Loopback only | Requests from other hosts are rejected regardless of the bind address |
| Per-process token | A fresh bearer token each startup; the extension reads it automatically |
| Redaction | Keys containing password, token, secret and similar return metadata only |
| Payload ceiling | Values above 64 KB are reported by size rather than transmitted |
Configuration
builder.Services.AddCacheLens(options =>
{
options.RedactKeyPatterns = ["password", "secret", "token", "apikey"];
options.MaxValuePayloadBytes = 64 * 1024;
options.RoutePrefix = "/_cachelens";
options.EnableDiscovery = true;
});
Scope
Supports .NET 8 and .NET 9, ASP.NET Core applications.
Not yet supported, stated plainly:
IMemoryCache, plusHybridCacheL1. HybridCache stores its in-process tier in the registeredIMemoryCache, so those entries are visible; its distributed tier is not.IDistributedCacheis not tracked — the in-memory provider holds its own private cache.- ASP.NET Core only — console applications and worker services are not yet covered.
- Entries cached before CacheLens starts are not tracked.
Website · Documentation · Source · Issues
MIT licensed.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- CacheLens.Core (>= 0.1.0)
-
net9.0
- CacheLens.Core (>= 0.1.0)
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 |
|---|---|---|
| 0.1.0 | 114 | 8/23/2026 |
First release. IMemoryCache tracking with values, expiration, sizes and per-key hit counts, exposed over a loopback-only token-protected endpoint for the CacheLens VS Code extension.