-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
69 changed files
with
3,131 additions
and
779 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/EFCoreSecondLevelCacheInterceptor.CacheManager.Core/EFCacheManagerCoreProviderOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
|
||
namespace EFCoreSecondLevelCacheInterceptor; | ||
|
||
/// <summary> | ||
/// Defines EFCoreSecondLevel's Options | ||
/// </summary> | ||
public static class EFCacheManagerCoreProviderOptions | ||
{ | ||
/// <summary> | ||
/// Introduces the built-in `CacheManagerCoreProvider` to be used as the CacheProvider. | ||
/// </summary> | ||
public static EFCoreSecondLevelCacheOptions UseCacheManagerCoreProvider(this EFCoreSecondLevelCacheOptions options) | ||
{ | ||
if (options == null) | ||
{ | ||
throw new ArgumentNullException(nameof(options)); | ||
} | ||
|
||
options.Settings.CacheProvider = typeof(EFCacheManagerCoreProvider); | ||
|
||
return options; | ||
} | ||
|
||
/// <summary> | ||
/// Introduces the built-in `CacheManagerCoreProvider` to be used as the CacheProvider. | ||
/// If you specify the `Cacheable()` method options, its setting will override this global setting. | ||
/// </summary> | ||
/// <param name="options"></param> | ||
/// <param name="expirationMode">Defines the expiration mode of the cache items globally.</param> | ||
/// <param name="timeout">The expiration timeout.</param> | ||
public static EFCoreSecondLevelCacheOptions UseCacheManagerCoreProvider(this EFCoreSecondLevelCacheOptions options, | ||
CacheExpirationMode expirationMode, | ||
TimeSpan timeout) | ||
{ | ||
if (options == null) | ||
{ | ||
throw new ArgumentNullException(nameof(options)); | ||
} | ||
|
||
options.Settings.CacheProvider = typeof(EFCacheManagerCoreProvider); | ||
|
||
options.Settings.CachableQueriesOptions = new CachableQueriesOptions | ||
{ | ||
ExpirationMode = expirationMode, | ||
Timeout = timeout, | ||
IsActive = true | ||
}; | ||
|
||
return options; | ||
} | ||
} |
Oops, something went wrong.