Frcs6.Extensions.Caching.MongoDB
2.0.0
See the version list below for details.
dotnet add package Frcs6.Extensions.Caching.MongoDB --version 2.0.0
NuGet\Install-Package Frcs6.Extensions.Caching.MongoDB -Version 2.0.0
<PackageReference Include="Frcs6.Extensions.Caching.MongoDB" Version="2.0.0" />
paket add Frcs6.Extensions.Caching.MongoDB --version 2.0.0
#r "nuget: Frcs6.Extensions.Caching.MongoDB, 2.0.0"
// Install Frcs6.Extensions.Caching.MongoDB as a Cake Addin #addin nuget:?package=Frcs6.Extensions.Caching.MongoDB&version=2.0.0 // Install Frcs6.Extensions.Caching.MongoDB as a Cake Tool #tool nuget:?package=Frcs6.Extensions.Caching.MongoDB&version=2.0.0
Frcs6.Extensions.Caching.MongoDB
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
- Add package Frcs6.Extensions.Caching.MongoDB.
- Inject Mongo cache using
MongoCachingServicesExtensions.AddMongoCache
. - Use
IDistributedCache
where you need it.
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 | Versions 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 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. |
-
net6.0
- Microsoft.Extensions.Caching.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Options (>= 6.0.0)
- MongoDB.Driver (>= 2.25.0)
-
net8.0
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.2)
- MongoDB.Driver (>= 2.25.0)
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.18 | 47 | 8/28/2024 |
2.0.17 | 86 | 8/27/2024 |
2.0.16 | 60 | 8/27/2024 |
2.0.15 | 59 | 8/27/2024 |
2.0.14 | 63 | 8/9/2024 |
2.0.13 | 62 | 8/9/2024 |
2.0.12 | 64 | 7/15/2024 |
2.0.11 | 59 | 7/15/2024 |
2.0.10 | 63 | 7/15/2024 |
2.0.9 | 60 | 7/15/2024 |
2.0.8 | 66 | 7/11/2024 |
2.0.7 | 61 | 7/11/2024 |
2.0.6 | 63 | 7/11/2024 |
2.0.5 | 64 | 7/11/2024 |
2.0.4 | 86 | 6/29/2024 |
2.0.3 | 78 | 6/29/2024 |
2.0.2 | 89 | 6/29/2024 |
2.0.1 | 97 | 6/3/2024 |
2.0.0 | 86 | 5/29/2024 |
1.2.4 | 84 | 5/27/2024 |
1.2.3 | 78 | 5/27/2024 |
1.2.2 | 90 | 5/27/2024 |
1.2.1 | 100 | 4/18/2024 |
1.2.0 | 89 | 4/18/2024 |
1.1.10 | 87 | 4/18/2024 |
1.1.9 | 81 | 4/2/2024 |
1.1.8 | 91 | 3/26/2024 |
1.1.7 | 89 | 3/26/2024 |
1.1.6 | 94 | 3/19/2024 |
1.1.5 | 96 | 3/19/2024 |
1.1.3 | 95 | 3/19/2024 |
1.1.2 | 91 | 3/19/2024 |
1.1.1 | 100 | 3/12/2024 |
1.1.0 | 115 | 3/10/2024 |
1.0.1 | 101 | 3/4/2024 |
1.0.0 | 99 | 3/3/2024 |
0.1.4 | 99 | 3/3/2024 |
0.1.3 | 95 | 3/2/2024 |
0.1.2 | 88 | 2/28/2024 |
0.1.1 | 83 | 2/28/2024 |
0.1.0 | 89 | 2/27/2024 |