Description
NeoSmart.Caching.Sqlite is an open-source package providing an IDistributedCache implementation backed by SQLite for ASP.NET Core projects that provides the middle ground between the ephemeral IMemoryCache and the full-blown IDistributedCache offerings that require separate servers or background services to provide a persistent key-value cache. Rationale, usage instructions, and more in the official release announcement.
SqliteCache for ASP.NET Core alternatives and similar packages
Based on the "Caching" category.
Alternatively, view SqliteCache for ASP.NET Core alternatives based on common mentions on social networks and blogs.
-
Electron.NET
:electron: Build cross platform desktop apps with ASP.NET Core (Razor Pages, MVC, Blazor). -
CacheManager
CacheManager is an open source caching abstraction layer for .NET written in C#. It supports various cache providers and implements many advanced features. -
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! -
FusionCache
FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features. -
Lazy Cache
An easy to use thread safe in-memory caching service with a simple developer friendly API for c# -
Shiny for Microsoft Application UI (MAUI), Xamarin Forms, Xamarin Native, & Blazor WebAssembly
.NET Framework for Backgrounding & Device Hardware Services (iOS, Android, & Catalyst) -
CacheCow
An implementation of HTTP Caching in .NET Core and 4.5.2+ for both the client and the server -
SharpRepository
C# Generic Repository for use with Entity Framework, RavenDB and more with built-in caching options. -
FastCache
7x-10x faster alternative to MemoryCache. A high-performance, lighweight (8KB dll) and thread-safe memory cache for .NET. -
Green Donut
DISCONTINUED. Green Donut is a port of facebook's DataLoader utility, written in C# for .NET Core and .NET Framework
CodeRabbit: AI Code Reviews for Developers

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of SqliteCache for ASP.NET Core or a related project?
README
SqliteCache for ASP.NET Core
SqliteCache is a persistent cache
implementing IDistributedCache
for ASP.NET Core projects.
SqliteCache uses a locally stored SQLite database file (taking advantage of SQLite's battle-tested
safe multi-threaded access features) to replicate persistent caching, allowing developers to mimic
the behavior of staging or production targets without all the overhead or hassle of a traditional
IDistributedCache
implementation. You can read more about its design and inspiration in the
official release post on the NeoSmart
blog.
Why NeoSmart.Caching.Sqlite
?
The currently available options for caching in ASP.NET Core projects are either all ephemeral
in-memory cache offerings (IMemoryCache
and co.) -- aka non-persistent -- or else have a whole
slew of dependencies and requirements that require at the very least administrator privileges and
background services hogging up system resources and needing updates and maintenance to requiring
multiple machines and a persistent network configuration.
NeoSmart.Caching.Sqlite
has no dependencies on background services that hog system resources and need to be updated or maintained (cough cough NCache cough cough)NeoSmart.Caching.Sqlite
is fully cross-platform and runs the same on your Windows PC or your colleagues' Linux, FreeBSD, and macOS workstations (unlike, say, Redis)NeoSmart.Caching.Sqlite
doesn't need administrator privileges to install - or even any installation for that matter (SQL Express LocalDB, this one is aimed at you)NeoSmart.Caching.Sqlite
is a fully containedIDistributedCache
offering that is installed and updated alongside the rest of your packages via NuGet, Paket, or whatever other option you're already using to manage your dependencies.
Installation
SqliteCache is available via the NuGet, and can be installed in the Package Manager Console as follows:
Install-Package NeoSmart.Caching.Sqlite
Usage
Using SqliteCache is straight-forward, and should be extremely familiar for anyone that's configured
an ASP.NET Core application before. Starting by adding a namespace import using
NeoSmart.Caching.Sqlite
makes things easier as the editor will pull in the correct extension
methods.
If using SqliteCache in an ASP.NET Core project, the SQLite-backed cache should be added as an
IDistributedCache
type by adding the following to your ConfigureServices
method, by default
located in Startup.cs
:
// using NeoSmart.Caching.Sqlite;
public void ConfigureServices(IServiceCollection services)
{
...
// Note: this *must* come before services.AddMvc()!
services.AddSqliteCache(options => {
options.CachePath = @"C:\data\bazaar\cache.db";
});
services.AddMvc();
...
}
Afterwards, the SqliteCache
instance will be made available to both the framework and the
application via dependency injection, and can be imported and used via either the
IDistributedCache
abstract type or the concrete SqliteCache
type:
// using Microsoft.Extensions.Caching.Distributed;
public class FooModel(DbContext db, IDistributedCache cache)
{
_db = db;
_cache = cache;
cache.SetString("foo", "bar");
Assert.AreEqual(cache.GetString("foo"), "bar");
Assert.AreEqual(typeof(NeoSmart.Caching.Sqlite.SqliteCache),
cache.GetType());
}
License
SqliteCache is developed and maintained by Mahmoud Al-Qudsi of NeoSmart Technologies. The project is provided free to the community under the terms of the MIT open source license.
Contributing
We are open to pull requests and contributions aimed at the code, documentation, unit tests, or anything else. If you're mulling an extensive contribution, file an issue first to make sure we're all on the same page, otherwise, PR away!
*Note that all licence references and agreements mentioned in the SqliteCache for ASP.NET Core README section above
are relevant to that project's source code only.