microservice.toolkit.cachemanager 0.6.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package microservice.toolkit.cachemanager --version 0.6.2
NuGet\Install-Package microservice.toolkit.cachemanager -Version 0.6.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="microservice.toolkit.cachemanager" Version="0.6.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add microservice.toolkit.cachemanager --version 0.6.2
#r "nuget: microservice.toolkit.cachemanager, 0.6.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.
// Install microservice.toolkit.cachemanager as a Cake Addin
#addin nuget:?package=microservice.toolkit.cachemanager&version=0.6.2

// Install microservice.toolkit.cachemanager as a Cake Tool
#tool nuget:?package=microservice.toolkit.cachemanager&version=0.6.2

Cache manager

The library is a work in progress. It is not yet considered production-ready.

Build Release License: MIT Nuget Nuget

Common interface to manage cache using different providers.

How to install

Package Manager

Install-Package microservice.toolkit.cachemanager -Version 0.6.2

.NET CLI

dotnet add package microservice.toolkit.cachemanager --version 0.6.2

Package Reference

<PackageReference Include="microservice.toolkit.cachemanager" Version="0.6.2" />

Available methods

Set(string, string, long);

Task<bool> Set(string key, string value, long issuedAt);

Adds an entry in the cache provider with an expiration time (UTC Unix timestamp in milliseconds).

// 2 days until expiration time
var issuedAt = DateTimeOffset.UtcNow.AddDays(2).ToUnixTimeMilliseconds()

Set(string, string);

Task<bool> Set(string key, string value);

Adds an entry in the cache provider without an expiration time.

Get(string);

Task<string> Get(string key);

Tries to retrieve the value of the entry using the key. If the entry does not exist or is expired the method returns null.

Delete(string);

Task<bool> Delete(string key);

Removed the entry from the cache provider.

Implementations

SQLite cache manager

<a name="sqlite"></a> To start using SQLite cache manager, first install the required package:

<PackageReference Include="Microsoft.Data.SQLite" Version="5.0.10" />

and create the table cache:

CREATE TABLE cache(
    id TEXT PRIMARY KEY,
    value TEXT NOT NULL,
    issuedAt INTEGER NOT NULL
);

MySQL cache manager

<a name="mysql"></a> To start using MySql cache manager, first install the required package:

<PackageReference Include="MySqlConnector" Version="1.3.12" />

and create the table cache:

CREATE TABLE cache(
    id VARCHAR(256) PRIMARY KEY,
    value TEXT NOT NULL,
    issuedAt BIGINT NOT NULL
);

Memcached

<a name="memcached"></a> To start using Memcached cache manager, first install the required package:

<PackageReference Include="Enyim.Memcached2" Version="0.6.8" />

How to use:

var manager = new MemcachedCacheManager("localhost:11211");

Or, if you are using a cluster:

var manager = new MemcachedCacheManager("localhost:11211,localhost:11212");

Redis

<a name="redis"></a> To start using Redis cache manager, first install the required package:

<PackageReference Include="StackExchange.Redis" Version="2.2.62" />

How to use:

var manager = new RedisCacheManager("localhost:6379");
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.11.2 96 4/6/2024
0.11.1 81 3/30/2024
0.11.0 74 3/30/2024
0.10.2 232 3/15/2023
0.10.1 316 1/18/2023
0.10.0 266 1/11/2023
0.9.1 347 11/22/2022
0.9.0 350 11/16/2022
0.8.0 447 10/12/2022
0.7.0 423 4/28/2022
0.6.2 410 2/28/2022
0.6.1 401 2/21/2022
0.6.0 438 1/15/2022
0.5.0 269 12/8/2021
0.4.9 282 12/2/2021
0.4.8 282 12/2/2021
0.4.7 272 12/2/2021
0.4.6 283 12/1/2021
0.4.5 3,362 11/25/2021
0.4.4 269 11/2/2021
0.4.3 276 11/2/2021
0.4.2 361 10/27/2021
0.4.1 325 10/21/2021
0.4.0 463 10/3/2021