![]() |
VOOZH | about |
dotnet add package Akavache --version 12.1.1
NuGet\Install-Package Akavache -Version 12.1.1
<PackageReference Include="Akavache" Version="12.1.1" />
<PackageVersion Include="Akavache" Version="12.1.1" />Directory.Packages.props
<PackageReference Include="Akavache" />Project file
paket add Akavache --version 12.1.1
#r "nuget: Akavache, 12.1.1"
#:package Akavache@12.1.1
#addin nuget:?package=Akavache&version=12.1.1Install as a Cake Addin
#tool nuget:?package=Akavache&version=12.1.1Install as a Cake Tool
👁 NuGet Stats
👁 Build
👁 Code Coverage
<br>
<a href="https://www.nuget.org/packages/akavache.sqlite3">
<img src="https://img.shields.io/nuget/dt/akavache.sqlite3.svg">
</a>
<a href="#backers">
<img src="https://opencollective.com/reactiveui/backers/badge.svg">
</a>
<a href="#sponsors">
<img src="https://opencollective.com/reactiveui/sponsors/badge.svg">
</a>
<a href="https://reactiveui.net/slack">
<img src="https://img.shields.io/badge/chat-slack-blue.svg">
</a>
<img alt="Akavache" src="https://raw.githubusercontent.com/reactiveui/styleguide/master/logo_akavache/main.png" width="150" />
Akavache is an asynchronous, persistent (i.e., writes to disk) key-value store created for writing desktop and mobile applications in C#, based on SQLite3. Akavache is great for both storing important data (i.e., user settings) as well as cached local data that expires.
Akavache V12 rewrites the SQLite backend for direct SQLitePCLRaw 3.x access, replacing the sqlite-net-pcl ORM layer entirely. The result is lower per-operation allocations, dedicated worker-thread serialization of all native handle access, and commit coalescing for concurrent writes.
SettingsBase properties are IObservable<T> — no more .Wait() deadlocksJsonTypeInfo<T> overloads for System.Text.Json, trim-safe out of the boxInterlocked patterns for idempotent disposeSee the for upgrade instructions.
<PackageReference Include="Akavache.Sqlite3" Version="*" />
<PackageReference Include="Akavache.SystemTextJson" Version="*" />
Note:
WithAkavache,WithAkavacheCacheDatabaseandInitializealways requires anISerializerdefined as a generic type, such asWithAkavache<SystemJsonSerializer>. This ensures the cache instance is properly configured for serialization.
using Akavache.Core;
using Akavache.SystemTextJson;
using Akavache.Sqlite3;
using Splat.Builder;
// Initialize with the builder pattern
AppBuilder.CreateSplatBuilder()
.WithAkavacheCacheDatabase<SystemJsonSerializer>(builder =>
builder.WithSqliteProvider() // REQUIRED: Explicitly initialize SQLite provider
.WithSqliteDefaults(),
"MyApp");
Important: Always call
WithSqliteProvider()explicitly beforeWithSqliteDefaults(). WhileWithSqliteDefaults()will automatically callWithSqliteProvider()if not already initialized (for backward compatibility), this automatic behavior is deprecated and may be removed in future versions. Explicit provider initialization is the recommended pattern for forward compatibility with other DI containers.
using Akavache.Core;
using Akavache.SystemTextJson;
using Akavache.Sqlite3;
using Splat.Builder;
// Example: Register Akavache with Splat DI
AppBuilder.CreateSplatBuilder()
.WithAkavache<SystemJsonSerializer>(
"MyApp",
builder => builder.WithSqliteProvider() // REQUIRED: Explicit provider initialization
.WithSqliteDefaults(),
(splat, instance) => splat.RegisterLazySingleton(() => instance));
// For in-memory cache (testing or lightweight scenarios):
AppBuilder.CreateSplatBuilder()
.WithAkavache<SystemJsonSerializer>(
"Akavache",
builder => builder.WithInMemoryDefaults(), // No provider needed for in-memory
(splat, instance) => splat.RegisterLazySingleton(() => instance));
// Store an object
var user = new User { Name = "John", Email = "john@example.com" };
await CacheDatabase.UserAccount.InsertObject("current_user", user);
// Retrieve an object
var cachedUser = await CacheDatabase.UserAccount.GetObject<User>("current_user");
// Store with expiration
await CacheDatabase.LocalMachine.InsertObject("temp_data", someData, DateTimeOffset.Now.AddHours(1));
// Get or fetch pattern
var data = await CacheDatabase.LocalMachine.GetOrFetchObject("api_data",
async () => await httpClient.GetFromJsonAsync<ApiResponse>("https://api.example.com/data"));
Akavache provides four types of caches:
// User preferences (persistent)
await CacheDatabase.UserAccount.InsertObject("user_settings", settings);
// API cache (temporary)
await CacheDatabase.LocalMachine.InsertObject("api_cache", apiData, DateTimeOffset.Now.AddHours(6));
// Sensitive data (encrypted)
await CacheDatabase.Secure.SaveLogin("john.doe", "secretPassword", "myapp.com");
// Session data (in-memory only)
await CacheDatabase.InMemory.InsertObject("current_session", sessionData);
Install the packages that match your needs. At minimum you need the core package plus a storage backend and a serializer.
| Purpose | Package | NuGet |
|---|---|---|
| Core (in-memory cache) | Akavache | 👁 AkavacheBadge |
| SQLite persistence | Akavache.Sqlite3 | 👁 Sqlite3Badge |
| Encrypted SQLite persistence | Akavache.EncryptedSqlite3 | 👁 EncryptedBadge |
| System.Text.Json serializer (recommended) | Akavache.SystemTextJson | 👁 STJBadge |
| System.Text.Json BSON serializer | Akavache.SystemTextJson.Bson | 👁 STJBsonBadge |
| Newtonsoft.Json serializer | Akavache.NewtonsoftJson | 👁 NewtonsoftBadge |
| HTTP download and caching extensions | Akavache.HttpDownloader | 👁 HttpBadge |
| Image/bitmap caching | Akavache.Drawing | 👁 DrawingBadge |
| Application settings helpers | Akavache.Settings | 👁 SettingsBadge |
| V10 → V11 data migration | Akavache.V10toV11 | 👁 MigrationBadge |
Akavache uses a modular package structure. Choose the packages that match your needs:
<PackageReference Include="Akavache" Version="*" />
<PackageReference Include="Akavache.Sqlite3" Version="*" />
<PackageReference Include="Akavache.EncryptedSqlite3" Version="*" />
<PackageReference Include="Akavache.SystemTextJson" Version="*" />
<PackageReference Include="Akavache.NewtonsoftJson" Version="*" />
<PackageReference Include="Akavache.HttpDownloader" Version="*" />
<PackageReference Include="Akavache.Drawing" Version="*" />
<PackageReference Include="Akavache.Settings" Version="*" />
Akavache supports:
net9.0-android, net9.0-ios, net9.0-maccatalyst, net10.0-android, net10.0-ios, net10.0-maccatalystnet9.0-windows10.0.19041.0, net10.0-windows10.0.19041.0 (WinUI), net9.0, net10.0 (cross-platform)| Serializer | .NET Framework 4.6.2+ | .NET 8.0+ | Mobile | Performance |
|---|---|---|---|---|
| System.Text.Json | ✅ Via NuGet | ✅ | ✅ | Fastest |
| Newtonsoft.Json | ✅ Built-in | ✅ | ✅ | Compatible |
Recommendation: Use System.Text.Json for new projects for best performance. Use Newtonsoft.Json when migrating from older Akavache versions or when you need maximum compatibility.
Akavache.Settings provides a specialized settings database for application configuration that survives app updates and reinstalls.
using Akavache.Settings;
// 1. Create a settings class — properties are IObservable<T>
public class AppSettings : SettingsBase
{
public AppSettings() : base(nameof(AppSettings)) { }
public IObservable<bool> EnableNotifications => GetOrCreateObservable(true);
public IObservable<Unit> SetEnableNotifications(bool value) => SetObservable(value, nameof(EnableNotifications));
public IObservable<string> UserName => GetOrCreateObservable("DefaultUser");
public IObservable<Unit> SetUserName(string value) => SetObservable(value, nameof(UserName));
}
// 2. Initialize with your app
var appSettings = default(AppSettings);
AppBuilder.CreateSplatBuilder()
.WithAkavache<SystemJsonSerializer>(builder =>
builder.WithApplicationName("MyApp")
.WithSqliteProvider()
.WithSettingsStore<AppSettings>(settings => appSettings = settings));
// 3. Use the settings — subscribe for live updates or read once
await appSettings.SetUserName("John Doe");
await appSettings.SetEnableNotifications(false);
var name = await appSettings.UserName.FirstAsync();
Console.WriteLine($"User: {name}");
Settings are automatically persisted and will survive app updates, making them perfect for user preferences and application configuration.
📚 Complete documentation is available in the folder:
This project is tested with BrowserStack.
We want to thank the following contributors and libraries that help make Akavache possible:
<a href="https://dotnetfoundation.org"> <img src="https://theme.dotnetfoundation.org/img/logo.svg" width="100" /> </a>
We thank Microsoft for their ongoing support of the .NET ecosystem and the development tools that make Akavache possible.
Akavache is licensed under the .
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net8.0-windows10.0.19041 net8.0-windows10.0.19041 is compatible. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net9.0-windows10.0.19041 net9.0-windows10.0.19041 is compatible. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-android36.0 net10.0-android36.0 is compatible. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-ios26.0 net10.0-ios26.0 is compatible. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-maccatalyst26.0 net10.0-maccatalyst26.0 is compatible. net10.0-macos net10.0-macos was computed. net10.0-macos26.0 net10.0-macos26.0 is compatible. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. net10.0-windows10.0.19041 net10.0-windows10.0.19041 is compatible. |
| .NET Framework | net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 is compatible. net48 net48 was computed. net481 net481 is compatible. |
Showing the top 5 NuGet packages that depend on Akavache:
| Package | Downloads |
|---|---|
|
Akavache.Sqlite3
Package Description |
|
|
SheshaMobile.Core
Common application functionality and features to be shared across the framework |
|
|
SheshaMobile.Modules
The modules module contains common functionality shared across multiple modules |
|
|
SheshaMobile.Modules.UserProfile
A module for building apps with user functionality |
|
|
SheshaMobile.Modules.Facilities
The facilities module contains common functionality for browsing and viewing facilities |
Showing the top 15 popular GitHub repositories that depend on Akavache:
| Repository | Stars |
|---|---|
|
CodeHubApp/CodeHub
CodeHub is an iOS application written using Xamarin
|
|
|
MoocDownloader/MoocDownloader
An MOOC downloader implemented by .NET. 一枚由 .NET 实现的 MOOC 下载器.
|
|
|
reactiveui/Camelotia
Cross-platform sample .NET GUI for cloud file management.
|
|
|
reactiveui/ReactiveUI.Samples
This repository contains ReactiveUI samples.
|
|
|
mmbot/mmbot
A C# port of Hubot
|
|
|
flagbug/Espera
Espera is a media player that plays your music, YouTube videos, SoundCloud songs and has a special "party mode".
|
|
|
Ombrelin/plex-rich-presence
A desktop app to enable discord rich presence for your Plex Media Server Activity
|
|
|
Clancey/gMusic
This is a multi platform music player.
|
|
|
thedillonb/CodeBucket
CodeBucket is the best way to browse and maintain your Bitbucket repositories on any iPhone, iPod Touch, and iPad device!
|
|
|
Titlehhhh/Minecraft-Holy-Client
A high-performance platform for running Minecraft stress-test bots written in C#.
|
|
|
Respawnsive/Apizr
Refit based web api client management, but resilient (retry, connectivity, cache, auth, log, priority, etc...)
|
|
|
kentcb/WorkoutWotch
Repository for my video series on building an iOS app in .NET.
|
|
|
BlossomiShymae/Needlework.Net
🪡 A .NET helper development tool for the LCU and Game Client!
|
|
|
thedillonb/RepoStumble
A mobile application for viewing GitHub repositories in a fashion similar to StumbleUpon
|
|
|
sthewissen/MVP
Unofficial app to help MVPs manage their community activities
|
| Version | Downloads | Last Updated |
|---|---|---|
| 12.1.1 | 2,488 | 6/3/2026 |
| 11.5.1 | 50,598 | 11/30/2025 |
| 11.4.1 | 24,640 | 9/9/2025 |
| 11.3.3 | 986 | 9/6/2025 |
| 11.1.1 | 1,649 | 9/2/2025 |
| 11.0.1 | 1,302 | 8/24/2025 |
| 10.2.41 | 26,714 | 3/16/2025 |
| 10.1.6 | 174,409 | 9/16/2024 |
| 10.0.1 | 102,971 | 5/1/2024 |
| 9.1.20 | 322,831 | 6/29/2023 |
| 9.1.7 | 70,174 | 2/1/2023 |
| 9.0.1 | 260,670 | 6/25/2022 |
| 8.1.1 | 218,836 | 12/12/2021 |
| 7.3.47 | 15,876 | 11/26/2021 |