Frcs6.Extensions.Caching.MongoDB
3.1.1
See the version list below for details.
dotnet add package Frcs6.Extensions.Caching.MongoDB --version 3.1.1
NuGet\Install-Package Frcs6.Extensions.Caching.MongoDB -Version 3.1.1
<PackageReference Include="Frcs6.Extensions.Caching.MongoDB" Version="3.1.1" />
paket add Frcs6.Extensions.Caching.MongoDB --version 3.1.1
#r "nuget: Frcs6.Extensions.Caching.MongoDB, 3.1.1"
// Install Frcs6.Extensions.Caching.MongoDB as a Cake Addin #addin nuget:?package=Frcs6.Extensions.Caching.MongoDB&version=3.1.1 // Install Frcs6.Extensions.Caching.MongoDB as a Cake Tool #tool nuget:?package=Frcs6.Extensions.Caching.MongoDB&version=3.1.1
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 | 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. net9.0 is compatible. |
-
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.28.0)
-
net9.0
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.0-rc.1.24431.7)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.0-rc.1.24431.7)
- Microsoft.Extensions.Options (>= 9.0.0-rc.1.24431.7)
- MongoDB.Driver (>= 2.28.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 |
---|---|---|
4.0.0 | 0 | 11/18/2024 |
3.1.9 | 0 | 11/18/2024 |
3.1.8 | 53 | 10/21/2024 |
3.1.7 | 47 | 10/15/2024 |
3.1.6 | 45 | 10/15/2024 |
3.1.5 | 48 | 10/10/2024 |
3.1.4 | 48 | 10/9/2024 |
3.1.3 | 44 | 10/9/2024 |
3.1.2 | 48 | 9/30/2024 |
3.1.1 | 56 | 9/23/2024 |
3.1.0 | 59 | 9/19/2024 |
3.1.0-beta0002 | 40 | 9/18/2024 |
3.1.0-beta0001 | 51 | 9/17/2024 |
3.0.1 | 89 | 9/17/2024 |
3.0.0 | 80 | 9/17/2024 |
2.0.22 | 88 | 9/12/2024 |
2.0.21 | 82 | 9/12/2024 |
2.0.20 | 84 | 9/12/2024 |
2.0.19 | 85 | 9/12/2024 |
2.0.18 | 95 | 8/28/2024 |
2.0.17 | 112 | 8/27/2024 |
2.0.16 | 87 | 8/27/2024 |
2.0.15 | 85 | 8/27/2024 |
2.0.14 | 106 | 8/9/2024 |
2.0.13 | 101 | 8/9/2024 |
2.0.12 | 86 | 7/15/2024 |
2.0.11 | 76 | 7/15/2024 |
2.0.10 | 79 | 7/15/2024 |
2.0.9 | 81 | 7/15/2024 |
2.0.8 | 83 | 7/11/2024 |
2.0.7 | 80 | 7/11/2024 |
2.0.6 | 91 | 7/11/2024 |
2.0.5 | 84 | 7/11/2024 |
2.0.4 | 102 | 6/29/2024 |
2.0.3 | 97 | 6/29/2024 |
2.0.2 | 107 | 6/29/2024 |
2.0.1 | 116 | 6/3/2024 |
2.0.0 | 104 | 5/29/2024 |
1.2.4 | 104 | 5/27/2024 |
1.2.3 | 108 | 5/27/2024 |
1.2.2 | 108 | 5/27/2024 |
1.2.1 | 117 | 4/18/2024 |
1.2.0 | 105 | 4/18/2024 |
1.1.10 | 107 | 4/18/2024 |
1.1.9 | 100 | 4/2/2024 |
1.1.8 | 109 | 3/26/2024 |
1.1.7 | 104 | 3/26/2024 |
1.1.6 | 110 | 3/19/2024 |
1.1.5 | 111 | 3/19/2024 |
1.1.3 | 110 | 3/19/2024 |
1.1.2 | 107 | 3/19/2024 |
1.1.1 | 113 | 3/12/2024 |
1.1.0 | 133 | 3/10/2024 |
1.0.1 | 118 | 3/4/2024 |
1.0.0 | 115 | 3/3/2024 |
0.1.4 | 116 | 3/3/2024 |
0.1.3 | 112 | 3/2/2024 |
0.1.2 | 106 | 2/28/2024 |
0.1.1 | 99 | 2/28/2024 |
0.1.0 | 105 | 2/27/2024 |