You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
+[Microsoft.Extensions.Caching.Memory](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Memory/) v2.0.2 or above (or v1.1.2, for NetStandard 1.3).
34
+
35
+
Polly.Caching.Memory >=v2.0.1 and <v3 requires:
31
36
32
37
+[Polly](https://nuget.org/packages/polly) >= v6.1.1 and <v7.
33
38
+[Microsoft.Extensions.Caching.Memory](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Memory/) v2.0.2 or above (or v1.1.2, for NetStandard 1.3).
34
39
35
-
Polly.Caching.Memory >= v2.0.1 requires:
40
+
Polly.Caching.Memory v2.0.0 requires:
36
41
37
42
+[Polly](https://nuget.org/packages/polly) >= v6.0.1 and <=v6.1.0.
38
43
+[Microsoft.Extensions.Caching.Memory](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Memory/) v2.0.2 or above (or v1.1.2, for NetStandard 1.3).
39
44
40
-
Polly.Caching.MemoryCache <v1.* requires:
45
+
Polly.Caching.MemoryCache v1.* requires:
41
46
42
47
+[Polly](https://nuget.org/packages/polly) >=v5.9.0 and <v6.
43
48
+[Microsoft.Extensions.Caching.Memory](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Memory/) v1.1.2, for NetStandard 1.3.
44
49
45
50
# How to use the Polly.Caching.Memory plugin
46
51
47
-
```csharp
48
-
// (1a): Create a MemoryCacheProvider instance in the .NET Framework, using the Polly.Caching.Memory nuget package.
49
-
// (full namespaces and types only shown here for disambiguation)
### Example: Configure CachePolicy via MemoryCacheProvider in StartUp, for DI
64
66
67
+
```csharp
68
+
// (We pass a whole PolicyRegistry by dependency injection rather than the individual policy,
69
+
// on the assumption the app will probably use multiple policies.)
65
70
66
-
// Or (1c): Configure by dependency injection within ASP.NET Core
67
-
// See https://docs.microsoft.com/en-us/aspnet/core/performance/caching/memory
68
-
// and https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection#registering-your-own-services
69
-
70
-
// (In this example we choose to pass a whole PolicyRegistry by dependency injection rather than the individual policy, on the assumption the webapp will probably use multiple policies across the app.)
@@ -117,6 +120,7 @@ For details of changes by release see the [change log](CHANGELOG.md).
117
120
*[@seanfarrow](https://github.com/seanfarrow) and [@reisenberger](https://github.com/reisenberger) - Initial caching architecture in the main Polly repo
118
121
*[@kesmy](https://github.com/kesmy) - original structuring of the build for msbuild15, in the main Polly repo
119
122
*[@seanfarrow](https://github.com/seanfarrow) - v2.0 update to Signed packages only to correspond with Polly v6.0.1
123
+
*[@reisenberger](https://github.com/reisenberger) - Update to Polly v7.0.0
[assembly:CLSCompliant(false)]// Because Microsoft.Extensions.Caching.Memory.MemoryCache, on which Polly.Caching.MemoryCache.NetStandard13 depends, is not CLSCompliant.
[assembly:CLSCompliant(false)]// Because Microsoft.Extensions.Caching.Memory.MemoryCache, on which Polly.Caching.MemoryCache.NetStandard13 depends, is not CLSCompliant.
/// Gets a value from the memory cache as part of an asynchronous execution. <para><remarks>The implementation is synchronous as there is no advantage to an asynchronous implementation for an in-memory cache.</remarks></para>
70
+
/// Gets a value from the cache asynchronously.
71
+
/// <para><remarks>The implementation is synchronous as there is no advantage to an asynchronous implementation for an in-memory cache.</remarks></para>
/// <param name="continueOnCapturedContext">Whether async calls should continue on a captured synchronization context. <para><remarks>For <see cref="MemoryCacheProvider"/>, this parameter is irrelevant and is ignored, as the implementation is synchronous.</remarks></para></param>
77
-
/// <returns>A <see cref="Task{TResult}" /> promising as Result the value from cache; or null, if none was found.</returns>
/// <param name="continueOnCapturedContext">Whether async calls should continue on a captured synchronization context. <para><remarks>Note: if the underlying cache's async API does not support controlling whether to continue on a captured context, async Policy executions with continueOnCapturedContext == true cannot be guaranteed to remain on the captured context.</remarks></para></param>
76
+
/// <returns>
77
+
/// A <see cref="Task{TResult}" /> promising as Result a tuple whose first element is a value indicating whether
78
+
/// the key was found in the cache, and whose second element is the value from the cache (null if not found).
// (With C#7.0, a ValueTask<> approach would be preferred, but some of our tfms do not support that. TO DO: Implement it, with preprocessor if/endif directives, for NetStandard)
// (With C#7.0, a ValueTask<> approach would be preferred, but some of our tfms do not support that. TO DO: Implement it, with preprocessor if/endif directives, for NetStandard)
0 commit comments