Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -506,13 +506,13 @@ For more information on the Circuit Breaker pattern in general see:
Policy<UserAvatar>
.Handle<FooException>()
.OrResult(null)
.Fallback<UserAvatar>(UserAvatar.Blank)
.Fallback<UserAvatar>(UserAvatar.Blank);

// Specify a func to provide a substitute value, if execution faults.
Policy<UserAvatar>
.Handle<FooException>()
.OrResult(null)
.Fallback<UserAvatar>(() => UserAvatar.GetRandomAvatar()) // where: public UserAvatar GetRandomAvatar() { ... }
.Fallback<UserAvatar>(() => UserAvatar.GetRandomAvatar()); // where: public UserAvatar GetRandomAvatar() { ... }

// Specify a substitute value or func, calling an action (eg for logging) if the fallback is invoked.
Policy<UserAvatar>
Expand Down Expand Up @@ -627,7 +627,7 @@ Policy

// Configure variable timeout via a func provider.
Policy
.Timeout(myTimeoutProvider)) // Func<TimeSpan> myTimeoutProvider
.Timeout(myTimeoutProvider) // Func<TimeSpan> myTimeoutProvider

// Timeout, calling an action if the action times out
Policy
Expand Down Expand Up @@ -795,10 +795,10 @@ var cachePolicy = Policy.Cache(memoryCacheProvider, TimeSpan.FromMinutes(5));
// - https://github.com/App-vNext/Polly.Caching.IDistributedCache

// Define a cache policy with absolute expiration at midnight tonight.
var cachePolicy = Policy.Cache(memoryCacheProvider, new AbsoluteTtl(DateTimeOffset.Now.Date.AddDays(1));
var cachePolicy = Policy.Cache(memoryCacheProvider, new AbsoluteTtl(DateTimeOffset.Now.Date.AddDays(1)));

// Define a cache policy with sliding expiration: items remain valid for another 5 minutes each time the cache item is used.
var cachePolicy = Policy.Cache(memoryCacheProvider, new SlidingTtl(TimeSpan.FromMinutes(5));
var cachePolicy = Policy.Cache(memoryCacheProvider, new SlidingTtl(TimeSpan.FromMinutes(5)));

// Define a cache Policy, and catch any cache provider errors for logging.
var cachePolicy = Policy.Cache(myCacheProvider, TimeSpan.FromMinutes(5),
Expand Down