Skip to content

Commit

Permalink
Merge pull request #394 from App-vNext/v570dev
Browse files Browse the repository at this point in the history
Merge v5.7.0dev branch to master
  • Loading branch information
reisenberger authored Jan 6, 2018
2 parents 64095be + 4df2018 commit 32c6228
Show file tree
Hide file tree
Showing 37 changed files with 2,000 additions and 125 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@

## 5.7.0
- Minor cache fixes
- Add ability to calculate cache Ttl based on item to cache
- Allow user-created custom policies

## 5.6.1
- Extend PolicyWrap syntax with interfaces

Expand Down
2 changes: 1 addition & 1 deletion GitVersionConfig.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
next-version: 5.6.1
next-version: 5.7.0
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,7 @@ For details of changes by release see the [change log](https://github.com/App-vN
* [@reisenberger](https://github.com/reisenberger) - Add new .HandleInner<TException>(...) syntax for handling inner exceptions natively.
* [@rjongeneelen](https://github.com/rjongeneelen) and [@reisenberger](https://github.com/reisenberger) - Allow PolicyWrap configuration to configure policies via interfaces.
* [@reisenberger](https://github.com/reisenberger) - Performance improvements.
* [@awarrenlove](https://github.com/awarrenlove) - Add ability to calculate cache Ttl based on item to cache.
# Sample Projects

Expand Down
14 changes: 9 additions & 5 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -92,12 +92,16 @@ Teardown(_ =>
Task("__Clean")
.Does(() =>
{
CleanDirectories(new DirectoryPath[] {
DirectoryPath[] cleanDirectories = new DirectoryPath[] {
buildDir,
artifactsDir,
testResultsDir,
nupkgDestDir
});
nupkgDestDir,
artifactsDir
};
CleanDirectories(cleanDirectories);
foreach(var path in cleanDirectories) { EnsureDirectoryExists(path); }
foreach(var path in solutionPaths)
{
Expand Down
6 changes: 6 additions & 0 deletions src/Polly.Net40Async.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
<releaseNotes>
v5.0 is a major release with significant new resilience policies: Timeout; Bulkhead Isolation; Fallback; Cache; and PolicyWrap. See release notes back to v5.0.0 for full details.

5.7.0
---------------------
- Minor cache fixes
- Add ability to calculate cache Ttl based on item to cache
- Allow user-created custom policies

5.6.1
---------------------
- Extend PolicyWrap syntax with interfaces
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.NetStandard11/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Runtime.CompilerServices;

[assembly: AssemblyTitle("Polly")]
[assembly: AssemblyVersion("5.6.1.0")]
[assembly: AssemblyVersion("5.7.0.0")]
[assembly: CLSCompliant(true)]

[assembly: InternalsVisibleTo("Polly.NetStandard11.Specs")]
6 changes: 3 additions & 3 deletions src/Polly.Shared/Caching/CacheEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal static partial class CacheEngine
{
internal static TResult Implementation<TResult>(
ISyncCacheProvider<TResult> cacheProvider,
ITtlStrategy ttlStrategy,
ITtlStrategy<TResult> ttlStrategy,
Func<Context, string> cacheKeyStrategy,
Func<Context, CancellationToken, TResult> action,
Context context,
Expand Down Expand Up @@ -48,8 +48,8 @@ internal static TResult Implementation<TResult>(

TResult result = action(context, cancellationToken);

Ttl ttl = ttlStrategy.GetTtl(context);
if (ttl.Timespan > TimeSpan.Zero)
Ttl ttl = ttlStrategy.GetTtl(context, result);
if (ttl.Timespan > TimeSpan.Zero && result != null && !result.Equals(default(TResult)))
{
try
{
Expand Down
6 changes: 3 additions & 3 deletions src/Polly.Shared/Caching/CacheEngineAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal static partial class CacheEngine
{
internal static async Task<TResult> ImplementationAsync<TResult>(
IAsyncCacheProvider<TResult> cacheProvider,
ITtlStrategy ttlStrategy,
ITtlStrategy<TResult> ttlStrategy,
Func<Context, string> cacheKeyStrategy,
Func<Context, CancellationToken, Task<TResult>> action,
Context context,
Expand Down Expand Up @@ -50,8 +50,8 @@ internal static async Task<TResult> ImplementationAsync<TResult>(

TResult result = await action(context, cancellationToken).ConfigureAwait(continueOnCapturedContext);

Ttl ttl = ttlStrategy.GetTtl(context);
if (ttl.Timespan > TimeSpan.Zero)
Ttl ttl = ttlStrategy.GetTtl(context, result);
if (ttl.Timespan > TimeSpan.Zero && result != null && !result.Equals(default(TResult)))
{
try
{
Expand Down
4 changes: 2 additions & 2 deletions src/Polly.Shared/Caching/CachePolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public override TResult ExecuteInternal<TResult>(Func<Context, CancellationToken
{
return CacheEngine.Implementation<TResult>(
_syncCacheProvider.For<TResult>(),
_ttlStrategy,
_ttlStrategy.For<TResult>(),
_cacheKeyStrategy,
action,
context,
Expand All @@ -75,7 +75,7 @@ public partial class CachePolicy<TResult> : Policy<TResult>, ICachePolicy<TResul
{
internal CachePolicy(
ISyncCacheProvider<TResult> syncCacheProvider,
ITtlStrategy ttlStrategy,
ITtlStrategy<TResult> ttlStrategy,
Func<Context, string> cacheKeyStrategy,
Action<Context, string> onCacheGet,
Action<Context, string> onCacheMiss,
Expand Down
4 changes: 2 additions & 2 deletions src/Polly.Shared/Caching/CachePolicyAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public override Task<TResult> ExecuteAsyncInternal<TResult>(Func<Context, Cancel
{
return CacheEngine.ImplementationAsync<TResult>(
_asyncCacheProvider.AsyncFor<TResult>(),
_ttlStrategy,
_ttlStrategy.For<TResult>(),
_cacheKeyStrategy,
action,
context,
Expand All @@ -65,7 +65,7 @@ public partial class CachePolicy<TResult>
{
internal CachePolicy(
IAsyncCacheProvider<TResult> asyncCacheProvider,
ITtlStrategy ttlStrategy,
ITtlStrategy<TResult> ttlStrategy,
Func<Context, string> cacheKeyStrategy,
Action<Context, string> onCacheGet,
Action<Context, string> onCacheMiss,
Expand Down
Loading

0 comments on commit 32c6228

Please sign in to comment.