Skip to content

An opinionated implementation of IDistrubutedCache interface made with MongoDb

License

Notifications You must be signed in to change notification settings

nebulateamwork/DistributedCache.MongoDb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DistributedCache MongoDb

This is an opionated implementation of the classic IDistributedCache on MongoDb database. The aim is to minimize call to the datatabse and using most up-to-date driver as possible.

The package is published on Nuget - TeamNebula - Mongodb Distributed cache

Usage

Usage is really simple, you just configure with the corresponding extensions methods.

services.AddMongoDbDistributedCache(options => 
{
    options.ConnectionString = "mongodb://...";
    options.DatabaseName = "my-database-name";
    options.CollectionName = "my-collection-name";
    options.DefaultCacheDurationsInMinutes = 10;
});

Also options has a special property called MongoClientFactory that allows the extension to call your function to obtain an instance of a IMongoClient. This allows for your application to manage all possible options in a centralized way (intercepting etc). Also allows you to have a single instance of the IMongoClient for your porcess (a well known best practice in MongoDb).

About

An opinionated implementation of IDistrubutedCache interface made with MongoDb

Resources

License

Stars

Watchers

Forks

Packages

No packages published