ZiggyCreatures.FusionCache 2.7.1

FusionCache

FusionCache logo

FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features.

It was born after years of dealing with all sorts of different types of caches: memory caching, distributed caching, http caching, CDNs, browser cache, offline cache, you name it.

So I tried to put together these experiences and came up with FusionCache.

FusionCache diagram

Being a hybrid cache means it can transparently work as either a normal memory cache (L1) or as a multi-level cache (L1+L2), where the distributed 2nd level (L2) can be any implementation of the standard IDistributedCache interface: this will get us better cold starts, better horizontal scalability, more resiliency and overall better performance.

FusionCache also includes an optional backplane for realtime sync between multiple nodes and advanced resiliency features like cache stampede protection, a fail-safe mechanism, soft/hard timeouts, eager refresh, full observability via logging and OpenTelemetry, tagging and much more.

It's being used in production on real-world projects with huge volumes for years, and is even used by Microsoft itself in its products like Data API Builder.

It's also compatible with the new HybridCache from Microsoft, thanks to a powerful integration.

๐Ÿ† Award

On August 2021, FusionCache received the Google Open Source Peer Bonus Award: here is the official blogpost.

๐Ÿ“• Getting Started

With ๐Ÿฆ„ A Gentle Introduction you'll get yourself comfortable with the overall concepts.

Want to start using it immediately? There's a โญ Quick Start for you.

Curious about what you can achieve from start to finish? There's a ๐Ÿ‘ฉโ€๐Ÿซ Step By Step guide.

In search of all the docs? There's a page for that, too.

๐Ÿง‘โ€๐Ÿซ Courses (more and more)

If you are interested in all things caching, I published 2 courses on Dometrain: Caching in .NET, Getting Started & Deep Dive.

Caching Course on Dometrain

Caching Course on Dometrain

If you like the FusionCache docs, you may like it too.

But mind you, it's not just about FusionCache but about caching as a whole: we'll go from the very foundations to pretty advanced topics and scenarios. We'll cover performance, robustness, resiliency and we'll see different real-world problems and, most importantly, solutions for them.

I tried condensing 20+ years dealing with caching in one place, all in an approachable way.

One journey, two chapters, filled with everything you can ask for about caching.

๐Ÿ“บ Talks (more)

Are you more into videos?

Along the years I've been lucky enough to be invited to some conferences, shows or podcasts both online and around the world, of course to talk about all things caching and FusionCache.

A good example is when the fine folks at On .NET invited me on the show to allow me to mumbling random caching stuff.

On .NET Talk

You can find most of them, sometimes with the related slides, in the dedicated repo here.

โœ” Features

FusionCache has a lot of features, let's see them grouped together:

Resiliency

Performance & Scalability

Flexibility

Observability

โ“‚๏ธ Microsoft HybridCache

We've probably all heard about the new kid on the block introduced by Microsoft with .NET 9: HybridCache.

So what does it mean for FusionCache? Does one replace the other? Or can they somehow work together?

It's pretty cool actually, so let's find out!

โญ Quick Start

Just install the ZiggyCreatures.FusionCache Nuget package:

PM> Install-Package ZiggyCreatures.FusionCache

Then, let's say we have a method that loads a product from the database:

Product GetProductFromDb(int id) {
	// DATABASE CALL HERE
}

(This is using the sync programming model, but it would be equally valid with the newer async one)

Then we create a FusionCache instance:

var cache = new FusionCache(new FusionCacheOptions());

or, if using dependency injection:

services.AddFusionCache();

Now, to get the product from the cache and, if not there, get it from the database in an optimized way and cache it for 30 sec:

var id = 42;

cache.GetOrSet<Product>(
	$"product:{id}",
	_ => GetProductFromDb(id),
	TimeSpan.FromSeconds(30)
);

That's it.

๐Ÿ–ฅ๏ธ Simulator

Distributed systems are, in general, quite complex to understand.

When using FusionCache with the distributed cache, the backplane and auto-recovery the Simulator can help us seeing the whole picture.

FusionCache Simulator

๐Ÿงฐ Supported Platforms

FusionCache targets .NET Standard 2.0 so any compatible .NET implementation is fine: this means .NET Framework (the old one), .NET Core 2+ and .NET 5/6+ (the new ones), Mono 5.4+ and more (see here for a complete rundown).

NOTE: if you are running on .NET Framework 4.6.1 and want to use .NET Standard packages Microsoft suggests to upgrade to .NET Framework 4.7.2 or higher (see the .NET Standard Documentation) to avoid some known dependency issues.

๐Ÿ†Ž Comparison

There are various alternatives out there with different features, different performance characteristics (cpu/memory) and in general a different set of pros/cons.

A feature comparison between existing .NET caching solutions may help you choose which one to use.

๐Ÿ’ผ Is it Production Ready :tm: ?

Yes!

FusionCache is being used in production on real world projects for years, happily handling billions of requests.

Considering that the FusionCache packages have been downloaded more than 72 million times (thanks everybody!) it may very well be used even more.

Oh, and it is being used in products by Microsoft itself, like Data API Builder!

๐Ÿ˜ Are you using it?

If you find FusionCache useful please let me know, I'm interested in knowing your use case!

This is the only way for me to know how it is helping people.

๐Ÿ’ฐ Support

Nothing to do here.

After years of using a lot of open source stuff for free, this is just me trying to give something back to the community.

Will FusionCache one day switch to a commercial model? Nope, not gonna happen.

Mind you: nothing against other projects making the switch, if done in a proper way, but no thanks not interested. And FWIW I don't even accept donations, which are btw a great thing: that should tell you how much I'm into this for the money.

Again, this is me trying to give something back to the community.

If you really want to talk about money, please consider making ๐Ÿฉท a donation to a good cause of your choosing, and let me know about that.

No packages depend on ZiggyCreatures.FusionCache.

  • Add: new DistributedLockerErrorsLogLevel option - Change: better handling of parent traces with observability - Change: now the tag is included in the trace when doing a RemoveByTag(tag) operation - Change: in the Advisor, add warning for System.Text.Json serialization issues related (mainly) to value tuples - Add: new SerializationConfigIssuesLogLevel option - Change: in the Advisor, better check for a missing CacheKeyPrefix - Fix: better temporal checks during an L2 to L1 copy - Fix: the OperationId is now automatically generated even without a logger if there are listeners for activities (e.g.: OTEL traces) - Fix: better exception handling for user-initiated cancellations while using the distributed locker - Fix: updated dependency to OpenTelemetry.Api to ensure a vulnerability fix in downstream dependencies - Perf: minor performance improvements, particularly in some commonly used internal checks - Update: package dependencies

Version Downloads Last updated
2.8.0 2 09/16/2026
2.7.2 10 08/29/2026
2.7.1 14 08/21/2026
2.7.0 13 08/19/2026
2.6.0 1,233 03/26/2026
2.5.0 36 03/26/2026
2.4.0 37 03/26/2026
2.3.0 38 03/26/2026
2.2.0 253 03/23/2026
2.2.0-preview-1 38 03/26/2026
2.1.0 39 03/26/2026
2.0.2 31 03/26/2026
2.0.1 35 03/26/2026
2.0.0 39 03/26/2026
2.0.0-preview-4 32 03/26/2026
2.0.0-preview-3 34 03/26/2026
2.0.0-preview-2 33 03/26/2026
2.0.0-preview-1 32 03/26/2026
1.4.1 24 03/26/2026
1.4.0 26 03/26/2026
1.3.0 37 03/26/2026
1.2.0 36 03/26/2026
1.2.0-preview1 35 03/26/2026
1.1.0 37 03/26/2026
1.0.0 34 03/26/2026
1.0.0-preview2 33 03/26/2026
1.0.0-preview1 32 03/26/2026
0.26.0 25 03/26/2026
0.25.0 27 03/26/2026
0.25.0-preview1 30 03/26/2026
0.24.0 38 03/26/2026
0.24.0-preview1 34 03/26/2026
0.23.0 36 03/26/2026
0.22.0 34 03/26/2026
0.21.0 36 03/26/2026
0.21.0-preview2 37 03/26/2026
0.21.0-preview1 29 03/26/2026
0.20.0 31 03/26/2026
0.20.0-preview2 30 03/26/2026
0.20.0-preview1 35 03/26/2026
0.19.0 39 03/26/2026
0.18.0 40 03/26/2026
0.17.0 29 03/26/2026
0.16.0 32 03/26/2026
0.15.0 35 03/26/2026
0.14.0 35 03/26/2026
0.13.0 23 03/26/2026
0.12.0 33 03/26/2026
0.11.1 32 03/26/2026
0.11.0 38 03/26/2026
0.10.0 39 03/26/2026
0.10.0-preview1 29 03/26/2026
0.9.0 34 03/26/2026
0.1.10-beta3 32 03/26/2026
0.1.10-beta2 34 03/26/2026
0.1.10-beta1 37 03/26/2026
0.1.10-alpha2 36 03/26/2026
0.1.10-alpha1 34 03/26/2026
0.1.9 36 03/26/2026
0.1.8 34 03/26/2026
0.1.7 34 03/26/2026
0.1.6 35 03/26/2026
0.1.5 35 03/26/2026
0.1.4 33 03/26/2026
0.1.3 34 03/26/2026
0.1.2 35 03/26/2026
0.1.1 34 03/26/2026
0.1.0 28 03/26/2026