public DataGroupBy10MinJob(ILogger <DataGroupBy10MinJob> logger, IEasyCachingProviderFactory providerFactory, IMJLogOtherRepository repository, IMJLog3Repository mjlog3repository)
 {
     _logger           = logger;
     _providerFactory  = providerFactory;
     _repository       = repository;
     _mjlog3repository = mjlog3repository;
 }
Exemplo n.º 2
0
 public ImageController(UserManager <AppUser> userManager, IEasyCachingProviderFactory cachingProviderFactory, AuthentificationContext db)
 {
     redisController = new RedisService(cachingProviderFactory);
     _userManager    = userManager;
     rpcClient       = new RpcClientService();
     _db             = db;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:EasyCaching.Interceptor.Castle.EasyCachingInterceptor"/> class.
 /// </summary>
 /// <param name="cacheProviderFactory">Cache provider factory.</param>
 /// <param name="keyGenerator">Key generator.</param>
 /// <param name="options">Options.</param>
 /// <param name="logger">logger </param>
 public EasyCachingInterceptor(IEasyCachingProviderFactory cacheProviderFactory, IEasyCachingKeyGenerator keyGenerator, IOptions <EasyCachingInterceptorOptions> options, ILogger <EasyCachingInterceptor> logger = null)
 {
     _options = options;
     _cacheProviderFactory = cacheProviderFactory;
     _keyGenerator         = keyGenerator;
     _logger = logger;
 }
Exemplo n.º 4
0
        //private readonly ILogger<CacheProvider> _looger;

        public CacheProvider(IEasyCachingProviderFactory easyCachingProviderFactory, ISerializer serializer /*, ILogger<CacheProvider> logger*/)
        {
            this._cachingProvider = easyCachingProviderFactory;
            this._provider        = this._cachingProvider.GetRedisProvider("redis");
            this._serializer      = serializer;
            //this._looger = logger;
        }
Exemplo n.º 5
0
 public CacheService(IItemService itemService, IUserService userService, IEasyCachingProviderFactory cachingProviderFactory)
 {
     _itemService = itemService;
     _userService = userService;
     this.cachingProviderFactory = cachingProviderFactory;
     this.cachingProvider        = this.cachingProviderFactory.GetCachingProvider("redisCache");
 }
Exemplo n.º 6
0
        public BController(ILogger <BController> logger, IEasyCachingProviderFactory cacheProviderFactory, BDbContext context)
        {
            _logger = logger;
            _cacheProviderFactory = cacheProviderFactory;
            _dbContext            = context;

            if (_dbContext.Database.EnsureCreated())
            {
                _dbContext.DemoObjs.AddRange(new List <DemeObj>()
                {
                    new DemeObj()
                    {
                        Id = 1, Name = "Jack"
                    },
                    new DemeObj()
                    {
                        Id = 2, Name = "Kobe"
                    },
                    new DemeObj()
                    {
                        Id = 3, Name = "Catcher"
                    },
                });
                _dbContext.SaveChanges();
            }
        }
 public DbStatisticsJob(ILogger <DbStatisticsJob> logger, IEasyCachingProviderFactory providerFactory, IMJLogOtherRepository repository, IMJLog3Repository mjlog3repository)
 {
     _logger           = logger;
     _providerFactory  = providerFactory;
     _repository       = repository;
     _mjlog3repository = mjlog3repository;
 }
 public OrderController(ApplicationDbContext context, IHttpClientFactory clientFactory, IEasyCachingProviderFactory cachingProviderFactory)
 {
     this.context                = context;
     this.clientFactory          = clientFactory;
     this.cachingProviderFactory = cachingProviderFactory;
     cachingProvider             = this.cachingProviderFactory.GetCachingProvider("redis-db");
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:EasyCaching.ResponseCaching.EasyCachingResponseCache"/> class.
        /// </summary>
        /// <param name="name">Provider Name</param>
        /// <param name="providerFactory">Provider factory</param>
        public EasyCachingResponseCache(string name,
                                        IEasyCachingProviderFactory providerFactory)
        {
            ArgumentCheck.NotNull(providerFactory, nameof(providerFactory));

            _provider = providerFactory.GetCachingProvider(name);
        }
Exemplo n.º 10
0
 public ValuesController(
     IEasyCachingProviderFactory providerFactory
     , BDbContext dbContext)
 {
     this._providerFactory = providerFactory;
     this._dbContext       = dbContext;
 }
Exemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:EasyCaching.HybridCache.HybridCachingProvider"/> class.
        /// </summary>
        /// <param name="name">Name.</param>
        /// <param name="optionsAccs">Options accs.</param>
        /// <param name="factory">Providers factory</param>
        /// <param name="bus">Bus.</param>
        /// <param name="loggerFactory">Logger factory.</param>
        public HybridCachingProvider(
            string name
            , HybridCachingOptions optionsAccs
            , IEasyCachingProviderFactory factory
            , IEasyCachingBus bus          = null
            , ILoggerFactory loggerFactory = null
            )
        {
            ArgumentCheck.NotNull(factory, nameof(factory));

            this._name    = name;
            this._options = optionsAccs;

            ArgumentCheck.NotNullOrWhiteSpace(_options.TopicName, nameof(_options.TopicName));

            if (optionsAccs.EnableLogging)
            {
                this._logger = loggerFactory.CreateLogger <HybridCachingProvider>();
            }

            // Here use the order to distinguish traditional provider
            this._localCache = factory.GetCachingProvider(_options.LocalCacheProviderName);

            // Here use the order to distinguish traditional provider
            this._distributedCache = factory.GetCachingProvider(_options.DistributedCacheProviderName);

            this._bus = bus ?? NullEasyCachingBus.Instance;
            this._bus.Subscribe(_options.TopicName, OnMessage);

            this._cacheId = Guid.NewGuid().ToString("N");
        }
Exemplo n.º 12
0
 public DeptAppService(IEasyCachingProviderFactory cacheFactory
                       , IEfRepository <SysDept> deptRepository
                       , UsrManager usrManager)
 {
     _cache          = cacheFactory.GetCachingProvider(EasyCachingConsts.RemoteCaching);
     _deptRepository = deptRepository;
     _usrManager     = usrManager;
 }
Exemplo n.º 13
0
 public DictAppService(IEfRepository <SysDict> dictRepository
                       , MaintManager maintManager
                       , IEasyCachingProviderFactory cacheFactory)
 {
     _dictRepository = dictRepository;
     _maintManager   = maintManager;
     _cache          = cacheFactory.GetCachingProvider(EasyCachingConsts.RemoteCaching);
 }
 public NacosServerManager(
     INacosNamingClient client,
     IEasyCachingProviderFactory factory,
     IOptions <NacosAspNetCoreOptions> optionsAccs)
 {
     _client   = client;
     _provider = factory.GetCachingProvider("nacos.aspnetcore");
 }
Exemplo n.º 15
0
 public CheckHisotryService(ILoggerFactory loggerFactory
                            , IEasyCachingProviderFactory factory)
 {
     _logger         = loggerFactory.CreateLogger <CheckHisotryService>();
     _factory        = factory;
     _memoryProvider = _factory.GetCachingProvider(EasyCachingConstValue.DefaultInMemoryName);
     _redisProvider  = _factory.GetCachingProvider(EasyCachingConstValue.DefaultCSRedisName);
 }
 public LoadDataService(ILogger <LoadDataService> logger, IServiceProvider IocContainer, IEasyCachingProviderFactory factory, IMJLogOtherRepository repository, IMJLog3Repository mjlog3repository, ICacheManage cache)
 {
     _logger           = logger;
     _factory          = factory;
     _repository       = repository;
     _mjlog3repository = mjlog3repository;
     _cache            = cache;
 }
Exemplo n.º 17
0
 public MenuAppService(IEfRepository <SysMenu> menuRepository,
                       IEfRepository <SysRelation> relationRepository,
                       IEasyCachingProviderFactory cacheFactory)
 {
     _menuRepository     = menuRepository;
     _relationRepository = relationRepository;
     _cache = cacheFactory.GetCachingProvider(EasyCachingConsts.RemoteCaching);
 }
Exemplo n.º 18
0
        public HybridCachingTest()
        {
            _namespace = "hybrid";

            var options = new HybridCachingOptions
            {
                EnableLogging                 = false,
                TopicName                     = "test_topic",
                LocalCacheProviderName        = "m1",
                DistributedCacheProviderName  = "myredis",
                BusRetryCount                 = 1,
                DefaultExpirationForTtlFailed = 60
            };

            IServiceCollection services = new ServiceCollection();

            services.AddEasyCaching(option =>
            {
                option.UseInMemory("m1");
                option.UseInMemory("m2");

                option.UseRedis(config =>
                {
                    config.DBConfig.Endpoints.Add(new Core.Configurations.ServerEndPoint("127.0.0.1", 6379));
                    config.DBConfig.Database = 5;
                }, "myredis");

                option.UseHybrid(config =>
                {
                    config.EnableLogging                = false;
                    config.TopicName                    = "test_topic";
                    config.LocalCacheProviderName       = "m1";
                    config.DistributedCacheProviderName = "myredis";
                });

                option.WithRedisBus(config =>
                {
                    config.Endpoints.Add(new Core.Configurations.ServerEndPoint("127.0.0.1", 6379));
                    config.Database = 6;
                });
            });

            IServiceProvider serviceProvider = services.BuildServiceProvider();

            factory = serviceProvider.GetService <IEasyCachingProviderFactory>();

            var bus = serviceProvider.GetService <IEasyCachingBus>();

            hybridCaching_1 = serviceProvider.GetService <IHybridCachingProvider>();

            fakeBus         = A.Fake <IEasyCachingBus>();
            fakeFactory     = A.Fake <IEasyCachingProviderFactory>();
            fakeDisProvider = A.Fake <FakeDistributedCachingProvider>();
            var myOptions = Options.Create(options);

            FakeCreatProvider();
            fakeHybrid = new HybridCachingProvider("h1", myOptions.Value, fakeFactory, fakeBus);
        }
 public RecipeDetailsRepository(IEasyCachingProviderFactory cachingProviderFactory,
                                IMediator mediator,
                                IRecipeDetailsMapper recipeDetailsMapper, IFilterFactory <RecipeDetails, RecipeSearchFilterCriteria> filterFactory)
 {
     _mediator            = mediator;
     _recipeDetailsMapper = recipeDetailsMapper;
     _filterFactory       = filterFactory;
     _cachingProvider     = cachingProviderFactory.GetCachingProvider(RedisConstants.Name);
 }
Exemplo n.º 20
0
 public ValuesController(
     IEasyCachingProviderFactory providerFactory
     , BDbContext dbContext
     , IHttpClientFactory clientFactory)
 {
     this._providerFactory = providerFactory;
     this._dbContext       = dbContext;
     this._clientFactory   = clientFactory;
 }
Exemplo n.º 21
0
 public CacheManage(IEasyCachingProviderFactory factory, IMemoryCache memoryCache, ILogger <CacheManage> logger, IMJLogOtherRepository repository, IMJLog3Repository mjlog3repository)
 {
     _logger           = logger;
     _factory          = factory;
     _redisProvider    = _factory.GetRedisProvider("userAction");
     _memoryCache      = memoryCache;
     _repository       = repository;
     _mjlog3repository = mjlog3repository;
 }
Exemplo n.º 22
0
        public DistributedEasyCaching(IEasyCachingProviderFactory easyCachingProviderFactory, IOptions <DistributedEasyCachingOptions> options)
            : base(options?.Value ?? throw new ArgumentNullException(nameof(options)))
        {
            if (easyCachingProviderFactory == null)
            {
                throw new ArgumentNullException(nameof(easyCachingProviderFactory));
            }

            _easyCachingProvider = easyCachingProviderFactory.GetCachingProvider(options.Value.ProviderName);
        }
Exemplo n.º 23
0
 public CheckDevices(ILogger <CheckDevices> logger, IServiceScopeFactory scopeFactor, IMqttServerEx serverEx
                     , IOptions <AppSettings> options, IEasyCachingProviderFactory factory)
 {
     _mcsetting   = options.Value.MqttClient;
     _logger      = logger;
     _scopeFactor = scopeFactor;
     _factory     = factory;
     _serverEx    = serverEx;
     _device      = _factory.GetCachingProvider("iotsharp");
 }
Exemplo n.º 24
0
 /// <summary>
 /// Using IMemoryCache as a cache service.
 /// </summary>
 public EFEasyCachingCoreProvider(
     IOptions <EFCoreSecondLevelCacheSettings> cacheSettings,
     IEasyCachingProviderFactory easyCachingProviderFactory,
     IReaderWriterLockProvider readerWriterLockProvider)
 {
     _cacheSettings              = cacheSettings?.Value;
     _readerWriterLockProvider   = readerWriterLockProvider;
     _easyCachingProviderFactory = easyCachingProviderFactory ?? throw new ArgumentNullException("Please register the `EasyCaching.Core`.");
     _easyCachingProvider        = _easyCachingProviderFactory.GetCachingProvider(_cacheSettings.ProviderName);
 }
Exemplo n.º 25
0
 public CfgAppService(IMapper mapper
                      , IEfRepository <SysCfg> cfgRepository
                      , ISystemManagerService systemManagerService
                      , IEasyCachingProviderFactory factory)
 {
     _mapper               = mapper;
     _cfgRepository        = cfgRepository;
     _systemManagerService = systemManagerService;
     _redis = factory.GetRedisProvider(EasyCachingConsts.RemoteCaching);
 }
Exemplo n.º 26
0
 public MQTTServerHandler(ILogger <MQTTServerHandler> logger, IServiceScopeFactory scopeFactor, IMqttServerEx serverEx
                          , IOptions <AppSettings> options, ICapPublisher queue, IEasyCachingProviderFactory factory
                          )
 {
     _mcsetting   = options.Value.MqttClient;
     _logger      = logger;
     _scopeFactor = scopeFactor;
     _factory     = factory;
     _serverEx    = serverEx;
     _queue       = queue;
 }
Exemplo n.º 27
0
 public NacosServerManager(
     INacosNamingClient client,
     IEasyCachingProviderFactory factory,
     IEnumerable <ILBStrategy> strategies,
     IOptions <NacosAspNetCoreOptions> optionsAccs)
 {
     _client   = client;
     _provider = factory.GetCachingProvider("nacos.aspnetcore");
     _strategy = strategies.FirstOrDefault(x => x.Name.ToString().Equals(optionsAccs.Value.LBStrategy, StringComparison.OrdinalIgnoreCase))
                 ?? new WeightRandomLBStrategy();
 }
Exemplo n.º 28
0
 public AuthController(IUserRepository userRepository, ICryptoService cryptoService, ITokenService tokenService, IOptions <AppSettings> appSettings, IUnitOfWork unitOfWork, IEasyCachingProviderFactory cachingProviderFactory, ICachingService cachingService)
 {
     _userRepository         = userRepository;
     _cryptoService          = cryptoService;
     _tokenService           = tokenService;
     _appSettings            = appSettings;
     _unitOfWork             = unitOfWork;
     _cachingProviderFactory = cachingProviderFactory;
     _cachingService         = cachingService;
     _easyCaching            = cachingProviderFactory.GetCachingProvider("redis_naim");;
 }
Exemplo n.º 29
0
        public HybridCachingTest()
        {
            _namespace = "hybrid";
            IServiceCollection services = new ServiceCollection();

            services.AddEasyCaching(option =>
            {
                option.UseInMemory("m1");
                option.UseInMemory("m2");

                option.UseRedis(config =>
                {
                    config.DBConfig.Endpoints.Add(new Core.Configurations.ServerEndPoint("127.0.0.1", 6379));
                    config.DBConfig.Database = 5;
                }, "myredis");

                option.WithRedisBus(config =>
                {
                    config.Endpoints.Add(new Core.Configurations.ServerEndPoint("127.0.0.1", 6379));
                    config.Database = 6;
                });
            });

            IServiceProvider serviceProvider = services.BuildServiceProvider();

            factory = serviceProvider.GetService <IEasyCachingProviderFactory>();

            var providers_1 = new List <IEasyCachingProvider>
            {
                factory.GetCachingProvider("m1"),
                factory.GetCachingProvider("myredis")
            };

            var providers_2 = new List <IEasyCachingProvider>
            {
                factory.GetCachingProvider("m2"),
                factory.GetCachingProvider("myredis")
            };

            var bus = serviceProvider.GetService <IEasyCachingBus>();

            hybridCaching_1 = new HybridCachingProvider(new OptionsWrapper <HybridCachingOptions>(new HybridCachingOptions
            {
                EnableLogging = false,
                TopicName     = "test_topic"
            }), providers_1, bus);

            hybridCaching_2 = new HybridCachingProvider(new OptionsWrapper <HybridCachingOptions>(new HybridCachingOptions
            {
                EnableLogging = false,
                TopicName     = "test_topic"
            }), providers_2, bus);
        }
Exemplo n.º 30
0
 public RoleAppService(IEfRepository <SysRole> roleRepository,
                       IEfRepository <SysUser> userRepository,
                       IEfRepository <SysRelation> relationRepository,
                       UsrManager usrManager,
                       IEasyCachingProviderFactory cacheFactory)
 {
     _roleRepository     = roleRepository;
     _userRepository     = userRepository;
     _relationRepository = relationRepository;
     _usrManager         = usrManager;
     _cache = cacheFactory.GetCachingProvider(EasyCachingConsts.RemoteCaching);
 }