/// <summary> /// EFCachePolicy Parser Utils /// </summary> public EFCachePolicyParser( IOptions <CacheAllQueriesOptions> cacheAllQueriesOptions, IEFCacheDependenciesProcessor cacheDependenciesProcessor) { _cacheAllQueriesOptions = cacheAllQueriesOptions?.Value; _cacheDependenciesProcessor = cacheDependenciesProcessor; }
/// <summary> /// Puts the whole system in cache. In this case calling the `Cacheable()` methods won't be necessary. /// If you specify the `Cacheable()` method, its setting will override this global setting. /// If you want to exclude some queries from this global cache, apply the `NotCacheable()` method to them. /// </summary> /// <param name="expirationMode">Defines the expiration mode of the cache item.</param> /// <param name="timeout">The expiration timeout.</param> public EFCoreSecondLevelCacheOptions CacheAllQueries(CacheExpirationMode expirationMode, TimeSpan timeout) { CacheAllQueriesOptions = new CacheAllQueriesOptions { ExpirationMode = expirationMode, Timeout = timeout, IsActive = true }; return(this); }
/// <summary> /// You can introduce a custom IEFCacheServiceProvider to be used as the CacheProvider. /// If you specify the `Cacheable()` method options, its setting will override this global setting. /// </summary> /// <param name="expirationMode">Defines the expiration mode of the cache items globally.</param> /// <param name="timeout">The expiration timeout.</param> /// <typeparam name="T">Implements IEFCacheServiceProvider</typeparam> public EFCoreSecondLevelCacheOptions UseCustomCacheProvider <T>(CacheExpirationMode expirationMode, TimeSpan timeout) where T : IEFCacheServiceProvider { CacheProvider = typeof(T); CacheAllQueriesOptions = new CacheAllQueriesOptions { ExpirationMode = expirationMode, Timeout = timeout, IsActive = true }; return(this); }
/// <summary> /// Introduces the built-in `EFMemoryCacheServiceProvider` to be used as the CacheProvider. /// If you specify the `Cacheable()` method options, its setting will override this global setting. /// </summary> /// <param name="expirationMode">Defines the expiration mode of the cache items globally.</param> /// <param name="timeout">The expiration timeout.</param> public EFCoreSecondLevelCacheOptions UseMemoryCacheProvider(CacheExpirationMode expirationMode, TimeSpan timeout) { CacheProvider = typeof(EFMemoryCacheServiceProvider); CacheAllQueriesOptions = new CacheAllQueriesOptions { ExpirationMode = expirationMode, Timeout = timeout, IsActive = true }; return(this); }
/// <summary> /// Introduces the built-in `EFRedisCacheServiceProvider` to be used as the CacheProvider. /// If you specify the `Cacheable()` method options, its setting will override this global setting. /// </summary> /// <param name="configuration">The string configuration to use for the multiplexer.</param> /// <param name="expirationMode">Defines the expiration mode of the cache items globally.</param> /// <param name="timeout">The expiration timeout.</param> public EFCoreSecondLevelCacheOptions UseRedisCacheProvider( string configuration, CacheExpirationMode expirationMode, TimeSpan timeout) { CacheProvider = typeof(EFRedisCacheServiceProvider); RedisConfiguration = configuration; CacheAllQueriesOptions = new CacheAllQueriesOptions { ExpirationMode = expirationMode, Timeout = timeout, IsActive = true }; return(this); }