FusionCache
SqliteCache for ASP.NET Core
FusionCache | SqliteCache for ASP.NET Core | |
---|---|---|
9 | 2 | |
1,320 | 71 | |
9.6% | - | |
8.8 | 6.5 | |
1 day ago | 2 months ago | |
C# | C# | |
MIT License | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
FusionCache
-
Release Radar • March 2024 Edition
Want an easy to use cache with advanced resiliency features? Look no further than FusionCache. It's built for performance, good refresh rates, better auto-setup, better logs, and more. Congrats to the team on shipping your first major and stable version 🎉 and receiving over 3.8 million downloads.
- FusionCache Is Now v1.0
-
Caching as a cross cutting concern using MediatR's pipeline behavior
I wrote an internal nuget package for our team that does similar stuff to your work, although I called mine ICachedRequest. Unlike you I denied myself the enjoyment of exploring a custom caching solution and ended up injecting FusionCache into my mediatr behavior.
-
17 Amazing Community Packages for .NET Developers
The most undervalued library from that list is FusionCache. The rest is either well-known (like FluentAssertions) or pretty specific to the guy's experience (like the WPF stuff).
-
Multi level cache library (in memory + Redis)
The instances (using FusionCache for instance) sync over Redis pub/sub.
- What your hidden nuget gems ?
-
How to implement cache
LazyCache is amazing. Btw I'm using FusionCache and it is good too
-
Ask HN: What are some 'cool' but obscure data structures you know about?
If you are in the .NET space I suggest you to take a look at FusionCache. It has cache stampede protection built in, plus some other nice features like a fail-safe mechanism and soft/hard timeouts https://github.com/jodydonetti/ZiggyCreatures.FusionCache
SqliteCache for ASP.NET Core
-
Storing query results
For pure key-value storage .net has IDistributedCache abstraction, with SQLite implementation. (This has no dependencies on asp.net core and can be used in any .net app)
-
In pursuit of the best value US cloud provider
This has been posted and reposted continuously for a year and I still don’t understand the comparisons in the article. Either use SQLite across the board or use MySQL/Postgres across the board. Or do both. You can even model a self-managed rdbms install on the clouds that don’t have that turnkey offering. But mixing and matching makes no sense.
I’m a huge fan of SQLite and have open sourced some .NET stuff around it (eg https://github.com/neosmart/AspSqliteCache ) but learned a very expensive mistake in using it for an ASP.NET Core Project with the default pattern (i.e. with EF Core).
SQLite locks (tables or the entire db depending on configuration) upon write. If you use shared cache mode and WAL you can get very far with one write thread and many competing reads - depending on shared cache mode, WAL, and other options. I benchmarked the different configurations with one or more writing threads here to show how it scales: https://github.com/mqudsi/sqlite-readers-writers
But this approach is hard to model with EF Core. If you use the default request-scoped DI injected connection, you risk any writes upgrading the read lock to a write lock for the duration of the request. The better approach is to use the default request-scoped connection for RO operations and then request a scoped/transient DI connection for any write ops, but copying internal EF entity tracking state from one EF instance to another is tedious and fraught with issues. You’re at least able to work around this if you try to always keep in mind write transaction lifetimes, though.
The problem comes as soon as you need a “background service” in the sense of “an operation running independently of requests and parallel to them.” If that service needs a write lock for any amount of time, you’re suddenly going to be seeing write timeouts (since default behavior is to poll repeatedly until a write lock is obtained) and that is pretty much impossible to fix.
As one of the biggest advantages of using a resident executor like .NET or Java vs a per-request stateless option like PHP is that you can do stuff independent of requests, SQLite is tricky to use correctly in prod in this model.
The good news is that if you use the SQLite EF provider and run into this, it’s usually not too hard to switch to a real DB provider as a lot of the work is abstracted.
What are some alternatives?
Lazy Cache - An easy to use thread safe in-memory caching service with a simple developer friendly API for c#
Cache Tower - An efficient multi-layered caching system for .NET
Akavache - An asynchronous, persistent key-value store created for writing desktop and mobile applications, based on SQLite3. Akavache is great for both storing important data as well as cached local data that expires.
EasyCaching - :boom: EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
CacheManager - CacheManager is an open source caching abstraction layer for .NET written in C#. It supports various cache providers and implements many advanced features.
NCache - NCache: Highly Scalable In-Memory Distributed Cache for .NET
SharpRepository - C# Generic Repository for use with Entity Framework, RavenDB and more with built-in caching options.
CacheCow - An implementation of HTTP Caching in .NET Core and 4.5.2+ for both the client and the server
Fine Code Coverage - Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too)