public static MongoCollection <MongoDBCacheEntity> GetMongoDBCollection(string cacheId)
        {
            IPartitionResolver resolver = new MongoDBCachePartitionResolver();
            string             mongoDbConnectionString = resolver.ResolvePartition(cacheId);
            MongoClient        client = new MongoClient(mongoDbConnectionString);
            MongoServer        srv    = client.GetServer();
            MongoDatabase      db     = srv.GetDatabase(MongoDBCacheConfiguration.DBName);

            if (!db.CollectionExists(MongoDBCacheConfiguration.TableName))
            {
                db.CreateCollection(MongoDBCacheConfiguration.TableName);
            }

            MongoCollection <MongoDBCacheEntity> collection = db.GetCollection <MongoDBCacheEntity>(MongoDBCacheConfiguration.TableName);

            return(collection);
        }
        public static MongoCollection <MongoDBCacheEntity> GetMongoDBCollection(string cacheId, Cachelimit cacheLimit)
        {
            IPartitionResolver resolver = new MongoDBCachePartitionResolver();
            string             mongoDbConnectionString = resolver.ResolvePartition(cacheId);
            MongoClient        client    = new MongoClient(mongoDbConnectionString);
            MongoServer        srv       = client.GetServer();
            MongoDatabase      db        = srv.GetDatabase(MongoDBCacheConfiguration.DBName);
            string             tableName = cacheLimit == Cachelimit.Forever ? MongoDBCacheConfiguration.TableName + "Forever" :  MongoDBCacheConfiguration.TableName + "ByExpireDate";

            if (!db.CollectionExists(tableName))
            {
                db.CreateCollection(tableName);
            }

            MongoCollection <MongoDBCacheEntity> collection = db.GetCollection <MongoDBCacheEntity>(tableName);

            return(collection);
        }