public EntityManager(IMemoryCacheService <T> cacheService, string connectionString, string commandText) { _cacheService = cacheService; _commandText = commandText; _connectionString = connectionString; _key = $"{typeof(T).Name}_Cache_{DateTime.UtcNow.Day}"; }
public ActivityLogService( MongoDbContext dbContext, IMemoryCacheService memoryCacheService) { _dbContext = dbContext; _memoryCacheService = memoryCacheService; }
public override async Task <HashSet <string> > GetSetAsync( string key, Func <IEnumerable <string> > factory = null ) { var result = IMemoryCacheService.Get <HashSet <string> >(key); if (result != null) { return(result); } var values = await IRedisGatewayService.GetSetAsync <string>(key); if (!values.HasContent()) { values = factory.Invoke().ToHashSet(); } await IRedisGatewayService.SetSetAsync(key, values); result = values.ToHashSet(); if (_UseCacheAside) { var entryOptions = new CacheOptions <HashSet <string> >(expirationType: CacheExpirationType.NotRemoveable); IMemoryCacheService.Set(key, result, entryOptions); } return(result); }
public ConfigurationService(IFileManager fileManager, IMemoryCacheService memoryCacheService) { _fileManager = fileManager; _memoryCacheService = memoryCacheService; _lockObject = new object(); LoadValuesIntoCache(); }
public InMemoryStoreTesting(IMemoryCacheService memoryCacheService, IWeatherService weatherService) { this.MemoryCacheService = memoryCacheService; this.WeatherService = weatherService; this.randomGenerator = new Random(); this.stream = new StreamWriter("in memory tests.txt", true); }
public ExpensesService(IDataRepository <Expense> expensesRepository, IDataRepository <ExpenseType> expenseTypeRepository, IMemoryCacheService <IEnumerable <ExpenseType> > cacheService) { _expensesRepository = expensesRepository; _expenseTypeRepository = expenseTypeRepository; _cacheService = cacheService; }
public HealthChecksService(ISyrinxCamundaClientService camundaService, IMemoryCacheService memoryCacheService, IPortalSettingsStore portalSettingsStore, IPortalSettingsService portalSettingsService, IModuleStore moduleStore) { this.camundaService = camundaService; this.memoryCacheService = memoryCacheService; this.portalSettingsStore = portalSettingsStore; this.portalSettingsService = portalSettingsService; this.moduleStore = moduleStore; }
public EmailAccountService( MongoDbContext dbContext, IMemoryCacheService memoryCacheService, IActivityLogService activityLogService) { _emailAccounts = dbContext.EmailAccounts; _memoryCacheService = memoryCacheService; _activityLogService = activityLogService; }
public IPDetailsService( SqlDbContext ctx, IIPInfoProvider ipInfoProvider, IMemoryCacheService memory ) { _ctx = ctx; _memory = memory; _ipInfoProvider = ipInfoProvider; }
/// <summary> /// ctor /// </summary> public Versioning( HttpContextBase httpCtx, IFileSystem fileSystem, IFileWatcherService fswSvc, IMemoryCacheService memoryCacheService ) { _httpCtx = httpCtx; _fs = fileSystem; _fswSvc = fswSvc; _memoryCacheService = memoryCacheService; }
public async Task <IDynamicCollection <T> > GetOrCreateAsync <T>( string listName, Func <IQueryable <T>, IQueryable <T> > query = null, Func <IEnumerable <T>, IEnumerable <T> > sorter = null ) where T : IEntity { var collectionKey = GetCollectionCacheKey(listName); var result = IMemoryCacheService.Get <IDynamicCollection <T> >(collectionKey); if (result != null) { return(result); } var IRepository = IContainerService.Get <IRepository <T> >(); var idsKey = GetIdsCacheKey(listName); var entityIds = await ICacheService.GetAsync <List <string> >(idsKey); if (entityIds == null) { var queryable = IRepository.GetQueryable(); if (query != null) { queryable = query(queryable); } var entities = await IDatabaseService.QueryAsync(queryable); await IEntityCacheService.Push(entities); entityIds = entities .Select(x => x?.Id) .ToList(); } else { await IRepository.GetManyByIdAsync(entityIds); } result = IDynamicCollectionFactory .Create(entityIds, sorter); IMemoryCacheService.Set(collectionKey, result); return(result); }
public DefaultAccessDispatcher ( IMemoryCacheService memoryCache, IJwtService jwtService, IRefreshTokenRepository refreshTokenRepository, IStorage storage ) { _memoryCache = memoryCache; _jwtService = jwtService; _refreshTokenRepository = refreshTokenRepository; _storage = storage; }
public override async Task <T> GetAsync <T>( string key, Func <T> factory = null, CacheOptions <T> options = null ) { var cacheObj = _UseCacheAside ? IMemoryCacheService.Get <T>(key) : default(T); if (cacheObj is NotFound) { return(default(T)); } var result = cacheObj == null ? default(T) : cacheObj; if (result != null) { return(result); } result = await IRedisGatewayService.GetAsync <T>(key); if (result == null) { if (factory != null) { result = factory(); } } if (result == null) { IMemoryCacheService.Set(key, NotFound.Shared); return(default(T)); } if (_UseCacheAside) { IMemoryCacheService.Set(key, result, options); } await IRedisGatewayService.SetAsync(key, result); return(result); }
public static T GetCacheObject(IMemoryCacheService cacheObj, CacheConfig config, string cacheKey) { T objectFromCache = default(T); if (!config.Enabled) { return(objectFromCache); } try { var response = (Cacheable <T>)cacheObj.Get(cacheKey); objectFromCache = response != null ? response.Model : default(T); } catch (Exception ex) { // LOG } return(objectFromCache); }
public FileSystemService( IMemoryCacheService memoryCacheService, IConfigurationService configurationService ) : base(memoryCacheService, configurationService) { Name = "File System"; ImagePath = "avares://Jaya.Provider.FileSystem/Assets/Images/Computer-32.png"; Description = "View your local drives, inspect their properties and play with directories & files stored within them."; IsRootDrive = true; ConfigurationEditorType = typeof(ConfigurationView); Configuration = this.configurationService.Get <FileSystemConfigModel>(); if (Configuration == null) { Configuration = new FileSystemConfigModel { IsProtectedFileVisible = false } } ; }
public static void StoreCacheObject(T data, IMemoryCacheService cacheObj, CacheConfig config, string cacheKey) { if (!config.Enabled) { return; } var dataToCache = new Cacheable <T> { TTL = DateTime.Now.AddMinutes(config.TimeToLiveMinutes), Model = data }; try { cacheObj.Remove(cacheKey); cacheObj.Put(cacheKey, dataToCache); } catch (Exception ex) { // LOG } }
public StatsController(IMemoryCacheService memoryCacheService) { _cacheService = memoryCacheService; }
public EmailAccountService( ObjectDbContext dbContext, IMemoryCacheService memoryCacheService) : base(dbContext) { _memoryCacheService = memoryCacheService; }
public ValuesController(IUserService userService, IMemoryCacheService cacheService) { this._userService = userService; this._cacheService = cacheService; }
public void Setup() { _fileManager = Substitute.For <IFileManager>(); _memoryCacheService = Substitute.For <IMemoryCacheService>(); }
public HomeController(IMemoryCacheService memoryCacheService) { this.memoryCacheService = memoryCacheService; }
public HomeController(IDataProtectionProvider provider, IMemoryCacheService cache) { protector = provider.CreateProtector("WebCore.HomeController.v1"); MemoryCacheService = cache; }
public SettingHelper(IMemoryCacheService memoryCacheService, IUmbracoContextFactory umbracoContextFactory) { _memoryCacheService = memoryCacheService; _umbracoContextFactory = umbracoContextFactory; }
protected readonly IConfigurationService configurationService; // Dependency #2 protected JayaPluginBase(IMemoryCacheService memoryCacheService, IConfigurationService configurationService) { this.memoryCacheService = memoryCacheService; // Dependency #1 this.configurationService = configurationService; // Dependency #2 }
public FriendService(IMemoryCacheService inMemoryCacheService) { InMemoryCacheService = inMemoryCacheService ?? throw new ArgumentNullException(nameof(inMemoryCacheService)); }
public CountriesController(ICountryService countryService, IMemoryCacheService memoryCacheService) { _countryService = countryService; _memoryCacheService = memoryCacheService; }
public ActivityLogTypeService( ObjectDbContext dbContext, IMemoryCacheService memoryCacheService) : base(dbContext) { _memoryCacheService = memoryCacheService; }
/// <summary> /// Initializes a new instance of the <see cref="MutantService"/> class. /// </summary> /// <param name="dnaService">Service of DNA</param> /// <param name="dnaService">Service for Memory Cache</param> public MutantService(IDnaService dnaService, IMemoryCacheService memoryCacheService) { _dnaService = dnaService; _memoryCacheService = memoryCacheService; }
public ContentEventHandler(IMemoryCacheService memoryCacheService) { _memoryCacheService = memoryCacheService; }
public TodoRepository(IMemoryCacheService memoryCacheService) { this.memoryCacheService = memoryCacheService; }