Frcs6.Extensions.Caching.MongoDB 1.2.1

dotnet add package Frcs6.Extensions.Caching.MongoDB --version 1.2.1
NuGet\Install-Package Frcs6.Extensions.Caching.MongoDB -Version 1.2.1
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="Frcs6.Extensions.Caching.MongoDB" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Frcs6.Extensions.Caching.MongoDB --version 1.2.1
#r "nuget: Frcs6.Extensions.Caching.MongoDB, 1.2.1"
#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 Frcs6.Extensions.Caching.MongoDB as a Cake Addin
#addin nuget:?package=Frcs6.Extensions.Caching.MongoDB&version=1.2.1

// Install Frcs6.Extensions.Caching.MongoDB as a Cake Tool
#tool nuget:?package=Frcs6.Extensions.Caching.MongoDB&version=1.2.1

Frcs6.Extensions.Caching.MongoDB

NuGet CI/CD Coverage Mutation score

Distributed cache implemented with MongoDB using Official .NET driver for MongoDB.

This implementation is based on the official version for Sql Server and Redis available here.

Installation / Usage

Some examples are available here.

MongoCache injection

You cand inject Mongo cache using MongoCachingServicesExtensions.AddMongoCache method with one of these parameters :

  • ConnectionString.
  • MongoClientSettings.
  • IMongoClient.

MongoClientSettings can be useful if you need to pass a certificate. You can read the official Mongo documentation Enable TLS on a Connection.

Examples

With connection string
const string connectionString = "mongodb://localhost:27017";
builder.Services.AddMongoCache(connectionString, options =>
{
    options.DatabaseName = "MyCacheDatabase";
    options.CollectionName = "MyCacheCollection";
    options.RemoveExpiredDelay = TimeSpan.FromSeconds(10);
});
With MongoClientSettings
var cert = new X509Certificate2("client.p12", "mySuperSecretPassword");
var settings = new MongoClientSettings
{
   SslSettings = new SslSettings
   {
      ClientCertificates = new[] { cert }
   },
   UseTls = true
};

builder.Services.AddMongoCache(settings, options =>
{
    options.DatabaseName = "MyCacheDatabase";
    options.CollectionName = "MyCacheCollection";
    options.RemoveExpiredDelay = TimeSpan.FromSeconds(10);
});

MongoCacheOptions

  • DatabaseName: Name of the cache database (required).
  • CollectionName: Name of the cache collection (required).
  • AllowNoExpiration: Allow item without expiration (default false).
  • RemoveExpiredDelay: Delay between each cache clean (default null).

Removing expired elements

Removing expired elements is automatic. The only option you have to set is RemoveExpiredDelay.

If RemoveExpiredDelay is not set, cleaning will launch on each cache access (Get, Set, Refresh).

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 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 is compatible.  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
1.2.1 84 4/18/2024
1.2.0 75 4/18/2024
1.1.10 74 4/18/2024
1.1.9 72 4/2/2024
1.1.8 81 3/26/2024
1.1.7 80 3/26/2024
1.1.6 83 3/19/2024
1.1.5 86 3/19/2024
1.1.3 86 3/19/2024
1.1.2 82 3/19/2024
1.1.1 88 3/12/2024
1.1.0 96 3/10/2024
1.0.1 88 3/4/2024
1.0.0 85 3/3/2024
0.1.4 85 3/3/2024
0.1.3 82 3/2/2024
0.1.2 79 2/28/2024
0.1.1 74 2/28/2024
0.1.0 79 2/27/2024