Example #1
0
 public ProductStoreFactoryBase(Func <string, IProductStore> versionFactory, ElasticConfiguration configuration, VersionedCacheProviderBase cacheProvider, DataOptions options)
 {
     _versionFactory = versionFactory;
     _configuration  = configuration;
     _cacheProvider  = cacheProvider;
     _expiration     = options.VersionCacheExpiration;
 }
        public static FactoryBuilder RegisterConsolidationCache(this IUnityContainer container, bool autoRegister, string defaultCode = null)
        {
            return(container.RegisterCustomFactory(autoRegister, (context, customer) =>
            {
                var currentCode = defaultCode ?? customer.CustomerCode;

                var logger = container.Resolve <ILogger>();
                var cacheProvider = new VersionedCacheProviderBase(logger);

                var invalidator = new DpcContentInvalidator(cacheProvider, logger);
                var connectionProvider = new ExplicitConnectionProvider(customer);
                var tracker = new StructureCacheTracker(customer.ConnectionString, customer.DatabaseType);
                var watcher = new CustomerCoreCacheItemWatcher(InvalidationMode.All, TimeSpan.FromSeconds(15), invalidator, connectionProvider, logger, databaseType: customer.DatabaseType);

                context.Register <ICacheProvider>(currentCode, cacheProvider);
                context.Register(currentCode, cacheProvider);
                context.Register <IContentInvalidator>(currentCode, invalidator);
                context.Register <ICacheItemWatcher>(currentCode, watcher);

                watcher.AttachTracker(tracker);
                watcher.Start();
            })
                   .For <ICacheProvider>(defaultCode)
                   .For <VersionedCacheProviderBase>(defaultCode)
                   .For <IContentInvalidator>(defaultCode)
                   .For <ICacheItemWatcher>(defaultCode));
        }
Example #3
0
 public RateLimitAttribute(ElasticConfiguration configuration, VersionedCacheProviderBase cacheProvider,
                           string profile)
 {
     _configuration = configuration;
     _cacheProvider = cacheProvider;
     Profile        = profile;
 }
 public SettingsFromContentCoreService(VersionedCacheProviderBase cacheProvider,
                                       IConnectionProvider connectionProvider,
                                       int settingsContentId)
     : base(connectionProvider, cacheProvider)
 {
     _cacheProvider     = cacheProvider;
     _settingsContentId = settingsContentId;
 }
 public ContentDefinitionService(ISettingsService settingsService,
                                 VersionedCacheProviderBase cacheProvider,
                                 IArticleService articleService,
                                 IConnectionProvider connectionProvider)
 {
     _settingsService = settingsService;
     _cacheProvider   = cacheProvider;
     _articleService  = articleService;
     _customer        = connectionProvider.GetCustomer();
 }
Example #6
0
        public TarantoolJsonService(ISettingsService settingsService, VersionedCacheProviderBase cacheProvider,
                                    IHttpClientFactory factory, IOptions <IntegrationProperties> intProps)
        {
            var tntUrl = intProps.Value.TarantoolApiUrl;

            _baseUri         = !String.IsNullOrEmpty(tntUrl) ? new Uri(tntUrl) : null;
            _settingsService = settingsService;
            _cacheProvider   = cacheProvider;
            _factory         = factory;
            _expiration      = TimeSpan.FromHours(1);
        }
Example #7
0
        public ArticleDependencyService(IContentDefinitionService contentDefinitionService, IServiceFactory serviceFactory, VersionedCacheProviderBase cacheProvider, ISettingsService settingsService, IConnectionProvider connectionProvider)
        {
            _contentDefinitionService = contentDefinitionService;

            _customer = connectionProvider.GetCustomer();

            _cacheProvider = cacheProvider;

            _prodDefContentId = int.Parse(settingsService.GetSetting(SettingsTitles.PRODUCT_DEFINITIONS_CONTENT_ID));

            _articleService = serviceFactory.GetArticleService();

            _fieldService = serviceFactory.GetFieldService();
        }
Example #8
0
 public ProductController(Func <string, string, IAction> getAction,
                          VersionedCacheProviderBase versionedCacheProvider,
                          Func <string, IArticleFormatter> getFormatter,
                          IProductLocalizationService localizationService,
                          IProductService productService,
                          QPHelper helper
                          )
 {
     _getAction = getAction;
     _versionedCacheProvider = versionedCacheProvider;
     _getFormatter           = getFormatter;
     _localizationService    = localizationService;
     _productService         = productService;
     _qpHelper = helper;
 }
        public CustomerCodeInstance(IConnectionProvider connectionProvider, ILogger logger)
        {
            CacheProvider = new VersionedCacheProviderBase(logger);
            Invalidator   = new DpcContentInvalidator(CacheProvider, logger);

            var customer = connectionProvider.GetCustomer();

            if (customer != null)
            {
                Watcher = new CustomerCoreCacheItemWatcher(InvalidationMode.All, TimeSpan.FromSeconds(15),
                                                           Invalidator, connectionProvider, logger, databaseType: customer.DatabaseType);
                Tracker = new StructureCacheTracker(customer.ConnectionString, customer.DatabaseType);
                Watcher.AttachTracker(Tracker);
                ((CacheItemWatcherBase)Watcher).Start();
            }
        }
Example #10
0
        public RegionTagService(VersionedCacheProviderBase cacheProvider, ISettingsService settingsService,
                                IRegionService regionService, IArticleService articleService, IFieldService fieldService,
                                IConnectionProvider connectionProvider)
        {
            _cacheProvider   = cacheProvider;
            _settingsService = settingsService;
            _regionService   = regionService;
            _articleService  = articleService;
            _fieldService    = fieldService;
            _customer        = connectionProvider.GetCustomer();

            TagsContentId      = int.Parse(_settingsService.GetSetting(SettingsTitles.REGIONAL_TAGS_CONTENT_ID));
            TagValuesContentId = int.Parse(_settingsService.GetSetting(SettingsTitles.REGIONAL_TAGS_VALUES_CONTENT_ID));
            RegionsContentId   = int.Parse(_settingsService.GetSetting(SettingsTitles.REGIONS_CONTENT_ID));
            TagTitleName       = _settingsService.GetSetting(SettingsTitles.REGIONAL_TAGS_KEY_FIELD_NAME) ?? "Title";
            TagValueName       = _settingsService.GetSetting(SettingsTitles.REGIONAL_TAGS_VALUES_VALUE_FIELD_NAME) ?? "Value";
        }
Example #11
0
 public LocalSystemCachedLoader(IContentDefinitionService definitionService,
                                VersionedCacheProviderBase cacheProvider,
                                ICacheItemWatcher cacheItemWatcher,
                                IReadOnlyArticleService articleService,
                                IFieldService fieldService,
                                ISettingsService settingsService,
                                IList <IConsumerMonitoringService> consumerMonitoringServices,
                                IArticleFormatter formatter, IConnectionProvider connectionProvider) : base(definitionService,
                                                                                                            cacheProvider, cacheItemWatcher, articleService, fieldService, settingsService, consumerMonitoringServices, formatter, connectionProvider)
 {
     DataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory") as string;
     if (DataDirectory == null)
     {
         throw new InvalidOperationException("Должен быть определен DataDirectory");
     }
     ArchiveFiles = true;
 }
Example #12
0
 public QpElasticConfiguration(
     IContentProvider <ElasticIndex> indexProvider,
     IContentProvider <HighloadApiUser> userProvider,
     IContentProvider <HighloadApiLimit> limitProvider,
     IContentProvider <HighloadApiMethod> methodProvider,
     VersionedCacheProviderBase cacheProvider,
     IHttpClientFactory factory,
     PolicyRegistry registry,
     ILoggerFactory loggerFactory,
     DataOptions dataOptions
     ) : base(factory, registry, loggerFactory, dataOptions)
 {
     _indexProvider  = indexProvider;
     _userProvider   = userProvider;
     _limitProvider  = limitProvider;
     _methodProvider = methodProvider;
     _cacheProvider  = cacheProvider;
 }
Example #13
0
 public ProductStoreFactory(Func <string, IProductStore> versionFactory, ElasticConfiguration configuration, VersionedCacheProviderBase cache, DataOptions options)
     : base(versionFactory, configuration, cache, options)
 {
 }
Example #14
0
 public RegionService(VersionedCacheProviderBase cacheProvider, ISettingsService settingsService, IConnectionProvider connectionProvider)
 {
     _cacheProvider   = cacheProvider;
     _settingsService = settingsService;
     _customer        = connectionProvider.GetCustomer();
 }
 protected ContentProviderBaseCached(ISettingsService settingsService, IConnectionProvider connectionProvider, VersionedCacheProviderBase cacheProvider) : base(settingsService, connectionProvider)
 {
     _cacheProvider = cacheProvider;
 }
Example #16
0
 public DBConnectorProxy(IConnectionProvider connectionProvider, VersionedCacheProviderBase cacheProvider)
 {
     _customer      = connectionProvider.GetCustomer();
     _cacheProvider = cacheProvider;
 }
Example #17
0
 public RateLimitRouteAttribute(ElasticConfiguration configuration, VersionedCacheProviderBase cacheProvider,
                                string profile) : base(configuration, cacheProvider, profile)
 {
 }
Example #18
0
        public QpCachedContextStorage(VersionedCacheProviderBase cacheProvider)
        {
            _cacheProvider = cacheProvider;

            CacheTime = TimeSpan.FromHours(1);
        }
Example #19
0
 public SettingsFromQpCoreService(VersionedCacheProviderBase cacheProvider, IConnectionProvider connectionProvider)
     : base(connectionProvider, cacheProvider)
 {
     _cacheProvider = cacheProvider;
 }
Example #20
0
 public NotificationChannelProvider(ISettingsService settingsService, IConnectionProvider connectionProvider, VersionedCacheProviderBase cacheProvider)
     : base(settingsService, connectionProvider, cacheProvider)
 {
 }
Example #21
0
 public StatusProvider(VersionedCacheProviderBase cacheProvider, IConnectionProvider connectionProvider)
 {
     _cacheProvider      = cacheProvider;
     _connectionProvider = connectionProvider;
 }
Example #22
0
 public DpcContentInvalidator(VersionedCacheProviderBase cacheProvider, ILogger logger)
 {
     _cacheProvider = cacheProvider;
     _logger        = logger;
 }