private void GetDataByCacheKey(IInvocation invocation, IRedisCacheService redisCacheService, ParameterInfo[] parameters, ServiceCacheAttribute svcCacheAttribute, string cacheKey) { int retryTimes = 0; if (redisCacheService.Contains(cacheKey)) { GetDataByCacheKey(invocation, redisCacheService, parameters, cacheKey); retryTimes = 0; } else { Label_RETRY: var isLock = CheckCacheKeyLock(invocation, redisCacheService, parameters, svcCacheAttribute, cacheKey); if (isLock) { while (retryTimes <= 3) { Thread.Sleep(500); retryTimes++; goto Label_RETRY; } var cacheKeyLocked = string.Format("{0}:LOCK", cacheKey); redisCacheService.Remove(cacheKeyLocked); } } }
/// <summary> /// Performs constructor injection for repository interfaces used in this service. /// </summary> /// <param name="userManager"></param> /// <param name="signInManager"></param> /// <param name="tokenManagement"></param> /// <param name="httpClient"></param> /// <param name="contextRepository"></param> /// <param name="userRepository"></param> /// <param name="httpContextAccessor"></param> /// <param name="milvaMailSender"></param> /// <param name="sharedLocalizer"></param> /// <param name="milvaLogger"></param> /// <param name="redisCacheService"></param> public AccountService(UserManager <AppUser> userManager, SignInManager <AppUser> signInManager, ITokenManagement tokenManagement, HttpClient httpClient, IContextRepository <EducationAppDbContext> contextRepository, IBaseRepository <AppUser, Guid, EducationAppDbContext> userRepository, IHttpContextAccessor httpContextAccessor, IMilvaMailSender milvaMailSender, IStringLocalizer <SharedResource> sharedLocalizer, IMilvaLogger milvaLogger, IRedisCacheService redisCacheService) : base(userManager, signInManager, tokenManagement, contextRepository, sharedLocalizer, httpContextAccessor, true) { _userName = httpContextAccessor.HttpContext.User.Identity.Name; _redisCacheService = redisCacheService; _milvaLogger = milvaLogger; _milvaMailSender = milvaMailSender; _userRepository = userRepository; _userManager = userManager; _signInManager = signInManager; _httpClient = httpClient; _contextRepository = contextRepository; _httpContextAccessor = httpContextAccessor; _localizer = sharedLocalizer; _tokenManagement = tokenManagement; _loginProvider = tokenManagement.LoginProvider; _tokenName = tokenManagement.TokenName; }
public ConsultantParser(IHtmlParser htmlParser, IRedisCacheService cache, IDatesRangeService rangeService, string calendarSourceFormat) { _htmlParser = htmlParser; _cache = cache; _rangeService = rangeService; _calendarSourceFormat = calendarSourceFormat; }
public BlogController(IPostService postService, ITaxonomyService taxonomyService, IRedisCacheService redisCacheService) { _postService = postService; _taxonomyService = taxonomyService; _redisCacheService = redisCacheService; recordsPerPage = 1; }
public ConversationService(IDialogflowService dialogflowService, IConsultantParser consultantParser, IRedisCacheService cache, IMapper mapper) { _dialogflowService = dialogflowService; _consultantParser = consultantParser; _cache = cache; _mapper = mapper; }
public AccountController(IUsyUserRepository userRepository, IRedisCacheService redisCache, ICacheService memoryCache) { _userRepository = userRepository; _redisCache = redisCache; _memoryCache = memoryCache; }
//private readonly IFilesService _filesService; //private readonly IConfiguration _configuration; //private readonly IHelper _helper; public CityManager(ICityRepository cityRepository, IMapper mapper, IRedisCacheService redisCacheService, BaseResponse <object> response) { _response = response; _redisCacheService = redisCacheService; _mapper = mapper; _cityRepository = cityRepository; }
public BaseController(IOptions <ApiServer> option, IRedisCacheService redisCache, ICacheService memoryCache) { ApiServerAddr = option.Value.Addr; AppId = option.Value.AppId; AppKey = option.Value.AppKey; _redisCache = redisCache; _memoryCache = memoryCache; }
public SberService( IConversationService conversationService, IMapper mapper, IRedisCacheService cache) : base(conversationService, mapper) { _mapper = mapper; _cache = cache; }
public MqttClientService(ILogger logger, IRedisCacheService redisCacheService, IManagedMqttClientOptions options) { this.options = options; this.logger = logger; this.redisCacheService = redisCacheService; mqttClient = new MqttFactory().CreateManagedMqttClient(); ConfigureMqttClient(); }
/// <summary> /// /// </summary> /// <param name="queryBus"></param> /// <param name="commandBus"></param> /// <param name="redisCacheService"></param> /// <param name="storage"></param> public DemoController(IQueryBus queryBus, ICommandBus commandBus, IRedisCacheService redisCacheService, IStorage storage, IUriService uriService) { _uriService = uriService; _queryBus = queryBus; _commandBus = commandBus; _redisCacheService = redisCacheService; _storage = storage; }
public HomeController(IUsyAppRepository appRepository, IRedisCacheService redisCache, ICacheService memoryCache, IHostingEnvironment env) { log = LogManager.GetLogger(Startup.log4netRepository.Name, typeof(HomeController)); _appRepository = appRepository; _redisCache = redisCache; _memoryCache = memoryCache; _env = env; }
public LoginService(IEncryptionService encryptionService, IRepository <DB.Entities.Users> userRepository, IUserService userService, IRedisCacheService redisCacheService, ICoreContext coreContext) { _encryptionService = encryptionService; _userRepository = userRepository; _userService = userService; _redisCacheService = redisCacheService; _coreContext = coreContext; }
public DbSyncService( IRedisCacheService redisCacheService, ITemperatureHumidityRepository temperatureHumidityRepository, IMotionDetectionRepository motionDetectionRepository) { this.redisCacheService = redisCacheService; this.motionDetectionRepository = motionDetectionRepository; this.temperatureHumidityRepository = temperatureHumidityRepository; }
public LoginFilter(IRedisCacheService redisCacheService, IEncryptionService encryptionService, IUserService userService, ICoreContext coreContext, IWorkContext workContext) { _redisCacheService = redisCacheService; _encryptionService = encryptionService; _coreContext = coreContext; _userService = userService; _workContext = workContext; }
public ManageController(IUsyUserRepository userRepository, IRedisCacheService redisCache, ICacheService memoryCache, IUsyMenuRepository menuRepository) { _userRepository = userRepository; _redisCache = redisCache; _memoryCache = memoryCache; _menuRepository = menuRepository; }
public Service(IUnitOfWork unitOfWork , IMapper mapper , IRedisCacheService redisCache , IHttpContextAccessor httpContextAccessor) { this.unitOfWork = unitOfWork; this.mapper = mapper; this.redisCache = redisCache; this.httpContextAccessor = httpContextAccessor; }
public CartItemsController( DiscountGrpcService discountGrpcService, ICartItemsService cartItemsService, IRedisCacheService cacheService, IMapper mapper) { _discountGrpcService = discountGrpcService; _cartItemsService = cartItemsService; _cacheService = cacheService; _mapper = mapper; }
public GetProductsHandler(IConfiguration config, IRedisCacheService cacheService) { if (config == null) { throw new ArgumentNullException(nameof(config)); } _cacheService = cacheService ?? throw new ArgumentNullException(nameof(cacheService)); _dbConnection = new Lazy <IDbConnection>(() => new SqlConnection(config.GetConnectionString("sqlserver"))); }
public RoleService(IUnitOfWork unitOfWork , IMapper mapper , IRedisCacheService redisCache , IHttpContextAccessor httpContextAccessor) : base(unitOfWork, mapper, redisCache, httpContextAccessor) { userRoleRepo = unitOfWork.Repository <UserRole>(); roleRepo = unitOfWork.Repository <Role>(); rolePermissionRepo = unitOfWork.Repository <RolePermission>(); userRepo = unitOfWork.Repository <User>(); }
public LoginFilter(IRedisCacheService redisCacheService, IEncryption encryption, IUserService userService, ICoreContext coreContext, IWorkContext workContext, IRoleService roleService, IStringLocalizer <VbtController> localizer) { _redisCacheService = redisCacheService; _encryption = encryption; _coreContext = coreContext; _userService = userService; _workContext = workContext; _roleService = roleService; _localizer = localizer; }
public EmployeesService(IRepository <DB.Entities.Employees> employeesRepository, IMapper mapper, IRedisCacheService redisCacheManager, IRepository <DB.Entities.Territories> territoriesRepository, IRepository <DB.Entities.EmployeeTerritories> employeeTerritoriesRepository, IRepository <DB.Entities.Region> regionRepository) { _employeesRepository = employeesRepository; _territoriesRepository = territoriesRepository; _employeeTerritoriesRepository = employeeTerritoriesRepository; _regionRepository = regionRepository; _mapper = mapper; _redisCacheManager = redisCacheManager; }
private void GetDataByCacheKey(IInvocation invocation, IRedisCacheService redisCacheService, ParameterInfo[] parameters, string cacheKey) { invocation.ReturnValue = redisCacheService.GetNullableData(cacheKey, invocation.Method.ReturnType); for (int i = 0; i < parameters.Length; i++) { if (parameters[i].ParameterType.IsByRef) { object argVal = redisCacheService.GetData(cacheKey + parameters[i].Name, parameters[i].ParameterType.GetElementType()); invocation.SetArgumentValue(i, argVal); } } }
private bool CheckCacheKey(IInvocation invocation, IRedisCacheService redisCacheService, ParameterInfo[] parameters, ServiceCacheAttribute svcCacheAttribute, string cacheKey) { if (redisCacheService.Contains(cacheKey)) { GetDataByCacheKey(invocation, redisCacheService, parameters, cacheKey); return(false); } else { CheckCacheKeyLock(invocation, redisCacheService, parameters, svcCacheAttribute, cacheKey); return(true); } }
public void Clear(IRedisCacheService cacheService) { cacheService.ClearServiceCache(); List <string> toRemove = new List <string>(); foreach (DictionaryEntry cacheItem in HttpRuntime.Cache) { toRemove.Add(cacheItem.Key.ToString()); } foreach (string key in toRemove) { HttpRuntime.Cache.Remove(key); } }
public EmployeesService(IRepository <DB.Entities.Employees> employeesRepository, IMapper mapper, IRedisCacheService redisCacheManager, IRepository <DB.Entities.Territories> territoriesRepository, IRepository <DB.Entities.EmployeeTerritories> employeeTerritoriesRepository, IRepository <DB.Entities.Region> regionRepository, VbtContext context, IRepository <DB.Entities.CategorySalesFor1997> categoryViewRepository) { _employeesRepository = employeesRepository; _territoriesRepository = territoriesRepository; _employeeTerritoriesRepository = employeeTerritoriesRepository; _regionRepository = regionRepository; _categoryViewRepository = categoryViewRepository; _mapper = mapper; _redisCacheManager = redisCacheManager; _context = context; }
private void AddCacheKey(IInvocation invocation, IRedisCacheService redisCacheService, ParameterInfo[] parameters, ServiceCacheAttribute svcCacheAttribute, string cacheKey) { invocation.Proceed(); redisCacheService.AddNullableData(cacheKey, invocation.ReturnValue, svcCacheAttribute.TimeoutSecs); for (int i = 0; i < parameters.Length; i++) { if (parameters[i].ParameterType.IsByRef && invocation.Arguments[i] != null) { redisCacheService.Add(cacheKey + parameters[i].Name, invocation.Arguments[i], svcCacheAttribute.TimeoutSecs); } } }
public LuisService(IOptions <LuisSettings> options, ILUISAuthoringClient luisAuthoringClient, ILUISRuntimeClient luisRuntimeClient, IRedisCacheService redisCache, HttpClient httpClient, ILogger <LuisService> logger) { _redisCache = redisCache; _luisSettings = options?.Value ?? throw new ArgumentNullException(nameof(options)); _logger = logger; _httpClient = httpClient; _luisRuntimeClient = luisRuntimeClient; _luisAuthoringClient = luisAuthoringClient; }
public AnswerService(MoMoDbContext context, IRedisCacheService cache, IHttpContextAccessor httpContextAccessor, IUnknownService issueService, HttpClient httpClient, KnowledgeMapContext mapContext, ILogger <AnswerService> logger) { _httpContextAccessor = httpContextAccessor; _issueService = issueService; _cache = cache; _context = context; _httpClient = httpClient; _logger = logger; _mapContext = mapContext; }
public ProductService( IRepository <Product> productRepository, IRepository <ExchangeType> exchangeTypeRepository, IMapper mapper, DevnotContext devnotContext, IRedisCacheService redisCacheManager, IRabbitMQService rabbitMQService ) { _productRepository = productRepository; _exchangeTypeRepository = exchangeTypeRepository; _mapper = mapper; _devnotContext = devnotContext; _redisCacheManager = redisCacheManager; _rabbitMQService = rabbitMQService; }