Frcs6.Extensions.Caching.MongoDB 0.1.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package Frcs6.Extensions.Caching.MongoDB --version 0.1.3
NuGet\Install-Package Frcs6.Extensions.Caching.MongoDB -Version 0.1.3
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="0.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Frcs6.Extensions.Caching.MongoDB --version 0.1.3
#r "nuget: Frcs6.Extensions.Caching.MongoDB, 0.1.3"
#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=0.1.3

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

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

  • Add package Frcs6.Extensions.Caching.MongoDB.
  • Inject MongoCache using MongoCachingServicesExtensions.AddMongoCache method.
  • Use IDistributedCache where you need it.

Some examples are available here.

Configuration

You can configure database connection in 3 ways :

  • With connection string.
  • By passing a MongoClientSettings.
  • By passing a IMongoClient.
const string connectionString = "mongodb://localhost:27017";
builder.Services.AddMongoCache(connectionString, options =>
{
    options.DatabaseName = "MyCacheDatabase";
    options.CollectionName = "MyCacheCollection";
    options.RemoveExpiredDelay = TimeSpan.FromSeconds(10);
});

MongoClientSettings can be useful if you need to pass a certificate.

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);
});

You can read Official Mongo documentation.

Cache option

  • DatabaseName: Name of the cache database.
  • CollectionName: Name of the cache collection.
  • AllowNoExpiration: Allow item without expiration.
  • RemoveExpiredDelay: Delay between each cache clean.

Cache cleanup

Cache cleaning will be launched on each cache call (Get, Set, Refresh) if the timeout is reached.

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
2.0.0 62 5/29/2024
1.2.4 75 5/27/2024
1.2.3 69 5/27/2024
1.2.2 74 5/27/2024
1.2.1 93 4/18/2024
1.2.0 80 4/18/2024
1.1.10 80 4/18/2024
1.1.9 74 4/2/2024
1.1.8 84 3/26/2024
1.1.7 82 3/26/2024
1.1.6 85 3/19/2024
1.1.5 88 3/19/2024
1.1.3 88 3/19/2024
1.1.2 84 3/19/2024
1.1.1 90 3/12/2024
1.1.0 98 3/10/2024
1.0.1 91 3/4/2024
1.0.0 87 3/3/2024
0.1.4 89 3/3/2024
0.1.3 84 3/2/2024
0.1.2 82 2/28/2024
0.1.1 75 2/28/2024
0.1.0 81 2/27/2024