public DonutContext(IRedisCacher cacher, Data.DataIntegration integration, IServiceProvider serviceProvider) { _cacher = cacher; ApiAuth = integration.APIKey; CacheRunInterval = 10; _currentCacheRunIndex = 0; Integration = integration; CurrentCache = new ConcurrentDictionary <string, List <HashEntry> >(); ConfigureCacheMap(); Prefix = $"integration_context:{Integration.Id}"; new ContextSetDiscoveryService(this, serviceProvider).Initialize(); _cachingService = new CachingPersistеnceService(this); if (integration != null && !string.IsNullOrEmpty(integration.FeaturesCollection)) { _encoder = FieldEncoder.Factory.Create(Integration); // var dbConfig = DBConfig.GetGeneralDatabase(); // var mongoList = new MongoList(dbConfig, integration.FeaturesCollection);//Make sure the collection exists // var murlBuilder = new MongoUrlBuilder(""); // murlBuilder.AuthenticationSource = "admin"; // var murl = murlBuilder.ToMongoUrl(); // var connection = new MongoClient(murl); // var database = connection.GetDatabase(""); //IMongoDatabase db = MongoHelper.GetDatabase(); //db.CreateCollection(integration.FeaturesCollection); } }
/// <inheritdoc /> public InternalCacheSet([NotNull] ISetCollection context) { _context = context; _dictionary = new ConcurrentDictionary <string, T>(); _list = new HashSet <T>(); _constructor = typeof(T).GetConstructor(new Type[] { }); _mergeLock = new object(); _cacheMap = RedisCacher.GetCacheMap <T>(); _cachingService = new CachingPersistеnceService(_context); }