Frcs6.Extensions.Caching.MongoDB
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Frcs6.Extensions.Caching.MongoDB --version 1.0.0
NuGet\Install-Package Frcs6.Extensions.Caching.MongoDB -Version 1.0.0
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.0.0" />
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.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Frcs6.Extensions.Caching.MongoDB, 1.0.0"
#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.0.0 // Install Frcs6.Extensions.Caching.MongoDB as a Cake Tool #tool nuget:?package=Frcs6.Extensions.Caching.MongoDB&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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
- 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 | 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 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.
-
net6.0
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.2)
- MongoDB.Driver (>= 2.24.0)
-
net7.0
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.2)
- MongoDB.Driver (>= 2.24.0)
-
net8.0
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.2)
- MongoDB.Driver (>= 2.24.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 |