JGUZDV.ClientStorage 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package JGUZDV.ClientStorage --version 1.0.2
                    
NuGet\Install-Package JGUZDV.ClientStorage -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JGUZDV.ClientStorage" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JGUZDV.ClientStorage" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="JGUZDV.ClientStorage" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add JGUZDV.ClientStorage --version 1.0.2
                    
#r "nuget: JGUZDV.ClientStorage, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package JGUZDV.ClientStorage@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=JGUZDV.ClientStorage&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=JGUZDV.ClientStorage&version=1.0.2
                    
Install as a Cake Tool

JGUZDV.ClientStorage

Simple caching and storage solution with optional background refreshs.

Setup

To use the ClientStorage you need an implementation of IMemoryCache, IKeyValueStorage and ILifeCycleEvents.

Using the Storage

//use DI
services.AddScoped<ClientStorage>();

//or new one up
var store = new ClientStorage(...);

Registration

You can register an entry like so

store.Register("testKey", new StoreOptions<string>
{
    LoadFunc = GetTestData, // function which returns the value
    UsesBackgroundRefresh = false, // configure if entry should be refreshed automatically
    ValueExpiry = TimeSpan.FromMinutes(10) // configure expiry time
});

and unregister

store.Unregister("testKey");

Retrieval

You can load an entry

var entry = await store.GetEntry<string>("testKey");

you can also load the value directly

var value = await store.Get<string>("testKey");

Combining registration and retrieval

you can also combine loading and registration like this

var entry = await store.GetOrLoadEntry("schedule", new StoreOptions<Schedule>
{
    ValueExpiry = _defaultExpiry,
    LoadFunc = (ct) => _scheduleService.GetSchedule(ct),
    UsesBackgroundRefresh = true
})

and you can also load the value directly

var value = await store.GetOrLoad("schedule", new StoreOptions<Schedule>
{
    ValueExpiry = _defaultExpiry,
    LoadFunc = (ct) => _scheduleService.GetSchedule(ct),
    UsesBackgroundRefresh = true
})
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on JGUZDV.ClientStorage:

Package Downloads
JGUZDV.JobHost.Dashboard.Blazor

Blazor components of Dashboard for JGUZDV.JobHost package.

JGUZDV.ClientStorage.Blazor

Blazor extensions for client storage

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 180 11/3/2026
1.0.3 387 11/7/2024
1.0.2 332 2/9/2024
1.0.1 331 11/22/2023
1.0.0 267 8/18/2023