@@ -26,17 +26,18 @@ This project, Polly.Caching.Distributed, allows you to use Polly's `CachePolicy`
2626
2727Polly.Caching.Distributed supports .NET Standard 1.1 and .NET Standard 2.0.
2828
29- ## Dependencies
29+ ## Versions and Dependencies
30+
31+ Polly.Caching.Distributed > ; =v2.0 and < ; v3 requires:
32+
33+ + [ Polly] ( nuget.org/packages/polly ) >= v6.0.1 and < ; v7.
34+ + [ Microsoft.Extensions.Caching.Abstractions] ( https://www.nuget.org/packages/Microsoft.Extensions.Caching.Abstractions/ ) v2.0.2 or above.
3035
3136Polly.Caching.IDistributedCache < ; v2.0 requires:
3237
3338+ [ Polly] ( nuget.org/packages/polly ) v5.4.0 or above.
3439+ [ Microsoft.Extensions.Caching.Abstractions] ( https://www.nuget.org/packages/Microsoft.Extensions.Caching.Abstractions/ ) v1.1.2 or above.
3540
36- Polly.Caching.Distributed > ; =v2.0 requires:
37-
38- + [ Polly] ( nuget.org/packages/polly ) v6.0.1 or above.
39- + [ Microsoft.Extensions.Caching.Abstractions] ( https://www.nuget.org/packages/Microsoft.Extensions.Caching.Abstractions/ ) v2.0.2 or above.
4041
4142# How to use the Polly.Caching.Distributed plugin
4243
@@ -84,7 +85,7 @@ public class Startup
8485
8586 services .AddSingleton <Polly .Caching .IAsyncCacheProvider <string >>(serviceProvider => serviceProvider .GetRequiredService <IDistributedCache >().AsAsyncCacheProvider <string >());
8687
87- services .AddSingleton <Polly .Registry .IPolicyRegistry <string >, Polly .Registry .PolicyRegistry >((serviceProvider ) =>
88+ services .AddSingleton <Polly .Registry .IReadOnlyPolicyRegistry <string >, Polly .Registry .PolicyRegistry >((serviceProvider ) =>
8889 {
8990 PolicyRegistry registry = new PolicyRegistry ();
9091 registry .Add (" myCachePolicy" , Policy .CacheAsync <string >(serviceProvider .GetRequiredService <IAsyncCacheProvider <string >>(), TimeSpan .FromMinutes (5 )));
@@ -98,7 +99,7 @@ public class Startup
9899
99100// In a controller, inject the policyRegistry and retrieve the policy:
100101// (magic string "myCachePolicy" hard-coded here only to keep the example simple)
101- public MyController (IPolicyRegistry < string > policyRegistry )
102+ public MyController (IReadOnlyPolicyRegistry < string > policyRegistry )
102103{
103104 var _cachePolicy = policyRegistry .Get <IAsyncPolicy <string >>(" myCachePolicy" );
104105 // ...
@@ -109,7 +110,7 @@ Usage:
109110
110111``` csharp
111112string productId = // ... from somewhere
112- string productDescription = await cachePolicy .ExecuteAsync (context => getProductDescription (productId ),
113+ string productDescription = await _cachePolicy .ExecuteAsync (context => getProductDescription (productId ),
113114 new Context (productId ) // productId will also be the cache key used in this execution.
114115 );
115116```
0 commit comments