Skip to content

Commit bd19386

Browse files
authored
Merge pull request #22 from App-vNext/v20dev
Release v2.0
2 parents 262dd9c + cb40671 commit bd19386

File tree

44 files changed

+246
-860
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+246
-860
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Polly.Caching.MemoryCache change log
22

3+
## 2.0.0
4+
- Provide a single signed package only.
5+
- Reference Polly v6.0.1.
6+
- Remove .net 4 and 4.5 support.
7+
- Add .net standard 2.0 as a target framework.
8+
- Change namespaces from Polly.Caching.MemoryCache to Polly.Caching.Memory to avoid clashes.
9+
310
## 1.1.0
411

512
- Polly.Caching.MemoryCache-Signed now references Polly-Signed

GitVersionConfig.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
next-version: 1.1.0
1+
next-version: 2.0.0

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,53 @@
1-
# Polly.Caching.MemoryCache
1+
# Polly.Caching.Memory
22

3-
This repo contains the MemoryCache plugin for the [Polly](https://github.com/App-vNext/Polly) [Cache policy](https://github.com/App-vNext/Polly/wiki/Cache). It targets .NET 4.0, .NET 4.5 and .NET Standard 1.3.
3+
This repo contains the MemoryCache plugin for the [Polly](https://github.com/App-vNext/Polly) [Cache policy](https://github.com/App-vNext/Polly/wiki/Cache). The current version targets .NET Standard 1.3 and .NET Standard 2.0.
44

5-
[![NuGet version](https://badge.fury.io/nu/Polly.Caching.MemoryCache.svg)](https://badge.fury.io/nu/Polly.Caching.MemoryCache) [![Build status](https://ci.appveyor.com/api/projects/status/pgd89nfdr9u4ig8m?svg=true)](https://ci.appveyor.com/project/joelhulen/polly-caching-memorycache) [![Slack Status](http://www.pollytalk.org/badge.svg)](http://www.pollytalk.org)
5+
[![NuGet version](https://badge.fury.io/nu/Polly.Caching.Memory.svg)](https://badge.fury.io/nu/Polly.Caching.Memory) [![Build status](https://ci.appveyor.com/api/projects/status/pgd89nfdr9u4ig8m?svg=true)](https://ci.appveyor.com/project/joelhulen/polly-caching-Memory) [![Slack Status](http://www.pollytalk.org/badge.svg)](http://www.pollytalk.org)
66

77
## What is Polly?
88

9-
[Polly](https://github.com/App-vNext/Polly) is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, Cache aside and Fallback in a fluent and thread-safe manner. Polly targets .NET 4.0, .NET 4.5 and .NET Standard 1.1.
9+
[Polly](https://github.com/App-vNext/Polly) is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, Cache aside and Fallback in a fluent and thread-safe manner. Polly targets .NET Standard 1.1 and .NET Standrad 2.0.
1010

1111
Polly is a member of the [.NET Foundation](https://www.dotnetfoundation.org/about)!
1212

1313
**Keep up to date with new feature announcements, tips & tricks, and other news through [www.thepollyproject.org](http://www.thepollyproject.org)**
1414

1515
![](https://raw.github.com/App-vNext/Polly/master/Polly-Logo.png)
1616

17-
# Installing Polly.Caching.MemoryCache via NuGet
17+
# Installing Polly.Caching.Memory via NuGet
1818

19-
Install-Package Polly.Caching.MemoryCache
19+
Install-Package Polly.Caching.Memory
2020

21-
You can install the Strongly Named version via:
22-
23-
Install-Package Polly.Caching.MemoryCache-Signed
2421

2522
# Supported targets
2623

27-
Polly.Caching.MemoryCache supports .NET4.0, .NET4.5 and .NetStandard 1.3.
24+
Polly.Caching.Memory >= v2.0 supports .NET Standard 1.3 and .NET Standard 2.0.
25+
26+
Polly.Caching.MemoryCache <v2.0 supports .NET4.0, .NET4.5 and .NetStandard 1.3
2827

2928
## Dependencies
3029

31-
Polly.Caching.MemoryCache works with Polly v5.9.0 and above.
30+
Polly.Caching.Memory >= v2.0 works with Polly v6.0.1 and above.
31+
32+
Polly.Caching.MemoryCache <v2.0 works with Polly v5.9.0 and above.
3233

33-
# How to use the Polly.Caching.MemoryCache plugin
34+
# How to use the Polly.Caching.Memory plugin
3435

3536
```csharp
36-
// (1a): Create a MemoryCacheProvider instance in the .NET Framework, using the Polly.Caching.MemoryCache nuget package.
37+
// (1a): Create a MemoryCacheProvider instance in the .NET Framework, using the Polly.Caching.Memory nuget package.
3738
// (full namespaces and types only shown here for disambiguation)
38-
Polly.Caching.MemoryCache.MemoryCacheProvider memoryCacheProvider
39-
= new Polly.Caching.MemoryCache.MemoryCacheProvider(System.Runtime.Caching.MemoryCache.Default);
39+
Polly.Caching.Memory.MemoryCacheProvider memoryCacheProvider
40+
= new Polly.Caching.Memory.MemoryCacheProvider(System.Runtime.Caching.MemoryCache.Default);
4041

4142
// Or (1b): Create a MemoryCacheProvider instance in .NET Core / .NET Standard.
4243
// (full namespaces and types only shown here for disambiguation)
4344
// NB Only if you want to create your own Microsoft.Extensions.Caching.Memory.MemoryCache instance:
4445
Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache
4546
= new Microsoft.Extensions.Caching.Memory.MemoryCache(new Microsoft.Extensions.Caching.Memory.MemoryCacheOptions());
46-
Polly.Caching.MemoryCache.MemoryCacheProvider memoryCacheProvider
47-
= new Polly.Caching.MemoryCache.MemoryCacheProvider(memoryCache);
47+
Polly.Caching.Memory.MemoryCacheProvider memoryCacheProvider
48+
= new Polly.Caching.Memory.MemoryCacheProvider(memoryCache);
4849

49-
// (2) Create a Polly cache policy using that Polly.Caching.MemoryCache.MemoryCacheProvider instance.
50+
// (2) Create a Polly cache policy using that Polly.Caching.Memory.MemoryCacheProvider instance.
5051
var cachePolicy = Policy.Cache(memoryCacheProvider, TimeSpan.FromMinutes(5));
5152

5253

@@ -99,6 +100,7 @@ For details of changes by release see the [change log](CHANGELOG.md).
99100
* [@reisenberger](https://github.com/reisenberger) - MemoryCache implementation
100101
* [@seanfarrow](https://github.com/seanfarrow) and [@reisenberger](https://github.com/reisenberger) - Initial caching architecture in the main Polly repo
101102
* [@kesmy](https://github.com/kesmy) - original structuring of the build for msbuild15, in the main Polly repo
103+
* [@seanfarrow](https://github.com/seanfarrow) - v2.0 update to Signed packages only to correspond with Polly v6.0.1
102104

103105

104106
# Instructions for Contributing

build.cake

Lines changed: 66 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ using System.Text.Json;
2525
// GLOBAL VARIABLES
2626
///////////////////////////////////////////////////////////////////////////////
2727

28-
var projectName = "Polly.Caching.MemoryCache";
28+
var projectName = "Polly.Caching.Memory";
2929
var keyName = "Polly.snk";
3030

3131
var solutions = GetFiles("./**/*.sln");
@@ -38,30 +38,27 @@ var testResultsDir = artifactsDir + Directory("test-results");
3838

3939
// NuGet
4040
var nuspecExtension = ".nuspec";
41-
var signed = "-Signed";
4241
var nuspecFolder = "nuget-package";
4342
var nuspecSrcFile = srcDir + File(projectName + nuspecExtension);
4443
var nuspecDestFile = buildDir + File(projectName + nuspecExtension);
45-
var nuspecSignedDestFile = buildDir + File(projectName + signed + nuspecExtension);
4644
var nupkgDestDir = artifactsDir + Directory(nuspecFolder);
4745
var snkFile = srcDir + File(keyName);
4846

4947
var projectToNugetFolderMap = new Dictionary<string, string[]>() {
50-
{ "Net45" , new [] {"net45"} },
51-
{ "NetStandard13" , new [] {"netstandard1.3"} },
52-
{ "Net40Async" , new [] {"net40"} },
53-
{ "Net45-Signed" , new [] {"net45"} },
54-
{ "NetStandard13-Signed", new [] {"netstandard1.3"} },
55-
{ "Net40Async-Signed" , new [] {"net40"} },
48+
{ "NetStandard13", new [] {"netstandard1.3"} },
49+
{ "NetStandard20", new [] {"netstandard2.0"} },
5650
};
5751

58-
var netStandard = "NetStandard";
59-
var specs = "Specs";
60-
6152
// Gitversion
6253
var gitVersionPath = ToolsExePath("GitVersion.exe");
6354
Dictionary<string, object> gitVersionOutput;
6455

56+
// Versioning
57+
string nugetVersion;
58+
string appveyorBuildNumber;
59+
string assemblyVersion;
60+
string assemblySemver;
61+
6562
// StrongNameSigner
6663
var strongNameSignerPath = ToolsExePath("StrongNameSigner.Console.exe");
6764

@@ -72,12 +69,13 @@ var strongNameSignerPath = ToolsExePath("StrongNameSigner.Console.exe");
7269

7370
Setup(_ =>
7471
{
75-
Information(@"");
76-
Information(@" ____ __ __ __ _ _ ___ __ ___ _ _ __ __ _ ___ _ _ ____ _ _ __ ____ _ _ ___ __ ___ _ _ ____ ");
77-
Information(@"( _ \ / \ ( ) ( ) ( \/ ) / __) / _\ / __)/ )( \( )( ( \ / __) ( \/ )( __)( \/ ) / \( _ \( \/ )/ __) / _\ / __)/ )( \( __)");
78-
Information(@" ) __/( O )/ (_/\/ (_/\ ) /_( (__ / \( (__ ) __ ( )( / /( (_ \ _ / \/ \ ) _) / \/ \( O )) / ) /( (__ / \( (__ ) __ ( ) _) ");
79-
Information(@"(__) \__/ \____/\____/(__/(_)\___)\_/\_/ \___)\_)(_/(__)\_)__) \___/(_)\_)(_/(____)\_)(_/ \__/(__\_)(__/ \___)\_/\_/ \___)\_)(_/(____)");
80-
Information(@"");
72+
// ASCII art via: http://patorjk.com/software/taag/?#p=display&f=Graceful&t=Polly.Caching.Memory%0A
73+
Information("");
74+
Information(@" ____ __ __ __ _ _ ___ __ ___ _ _ __ __ _ ___ _ _ ____ _ _ __ ____ _ _ ");
75+
Information(@"( _ \ / \ ( ) ( ) ( \/ ) / __) / _\ / __)/ )( \( )( ( \ / __) ( \/ )( __)( \/ ) / \( _ \( \/ )");
76+
Information(@" ) __/( O )/ (_/\/ (_/\ ) /_( (__ / \( (__ ) __ ( )( / /( (_ \ _ / \/ \ ) _) / \/ \( O )) / ) / ");
77+
Information(@"(__) \__/ \____/\____/(__/(_)\___)\_/\_/ \___)\_)(_/(__)\_)__) \___/(_)\_)(_/(____)\_)(_/ \__/(__\_)(__/ ");
78+
Information("");
8179
});
8280

8381
Teardown(_ =>
@@ -134,38 +132,62 @@ Task("__UpdateAssemblyVersionInformation")
134132
gitVersionOutput = new JsonParser().Parse<Dictionary<string, object>>(output);
135133

136134
Information("Updated GlobalAssemblyInfo");
137-
Information("AssemblyVersion -> {0}", gitVersionOutput["AssemblySemVer"]);
138-
Information("AssemblyFileVersion -> {0}", gitVersionOutput["MajorMinorPatch"]);
139-
Information("AssemblyInformationalVersion -> {0}", gitVersionOutput["InformationalVersion"]);
135+
136+
Information("");
137+
Information("Obtained raw version info for package versioning:");
138+
Information("NuGetVersion -> {0}", gitVersionOutput["NuGetVersion"]);
139+
Information("FullSemVer -> {0}", gitVersionOutput["FullSemVer"]);
140+
Information("AssemblySemVer -> {0}", gitVersionOutput["AssemblySemVer"]);
141+
142+
appveyorBuildNumber = gitVersionOutput["FullSemVer"].ToString();
143+
nugetVersion = gitVersionOutput["NuGetVersion"].ToString();
144+
assemblyVersion = gitVersionOutput["Major"].ToString() + ".0.0.0";
145+
assemblySemver = gitVersionOutput["AssemblySemVer"].ToString();
146+
147+
Information("");
148+
Information("Mapping versioning information to:");
149+
Information("Appveyor build number -> {0}", appveyorBuildNumber);
150+
Information("Nuget package version -> {0}", nugetVersion);
151+
Information("AssemblyVersion -> {0}", assemblyVersion);
152+
Information("AssemblyFileVersion -> {0}", assemblySemver);
153+
Information("AssemblyInformationalVersion -> {0}", assemblySemver);
140154
});
141155

142156
Task("__UpdateDotNetStandardAssemblyVersionNumber")
143157
.Does(() =>
144158
{
145-
// NOTE: TEMPORARY fix only, while GitVersionTask does not support .Net Standard assemblies. See https://github.com/App-vNext/Polly/issues/176.
146-
// This build Task can be removed when GitVersionTask supports .Net Standard assemblies.
147-
var assemblySemVer = gitVersionOutput["AssemblySemVer"].ToString();
148-
Information("Updating NetStandard AssemblyVersions to {0}", assemblySemVer);
159+
Information("Updating Assembly Version Information");
160+
161+
var attributeToValueMap = new Dictionary<string, string>() {
162+
{ "AssemblyVersion", assemblyVersion },
163+
{ "AssemblyFileVersion", assemblySemver },
164+
{ "AssemblyInformationalVersion", assemblySemver },
165+
};
166+
149167
var assemblyInfosToUpdate = GetFiles("./src/**/Properties/AssemblyInfo.cs")
150168
.Select(f => f.FullPath)
151-
.Where(f => f.Contains(netStandard))
152-
.Where(f => !f.Contains(specs));
153-
154-
foreach(var assemblyInfo in assemblyInfosToUpdate) {
155-
var replacedFiles = ReplaceRegexInFiles(assemblyInfo, "AssemblyVersion[(]\".*\"[)]", "AssemblyVersion(\"" + assemblySemVer +"\")");
156-
if (!replacedFiles.Any())
157-
{
158-
throw new Exception("AssemblyVersion could not be updated in " + assemblyInfo + ".");
169+
.Where(f => !f.Contains("Specs"));
170+
171+
foreach(var attributeMap in attributeToValueMap) {
172+
var attribute = attributeMap.Key;
173+
var value = attributeMap.Value;
174+
175+
foreach(var assemblyInfo in assemblyInfosToUpdate) {
176+
var replacedFiles = ReplaceRegexInFiles(assemblyInfo, attribute + "[(]\".*\"[)]", attribute + "(\"" + value +"\")");
177+
if (!replacedFiles.Any())
178+
{
179+
throw new Exception($"{attribute} attribute could not be updated in {assemblyInfo}.");
180+
}
159181
}
160182
}
183+
161184
});
162185

163186
Task("__UpdateAppVeyorBuildNumber")
164187
.WithCriteria(() => AppVeyor.IsRunningOnAppVeyor)
165188
.Does(() =>
166189
{
167-
var fullSemVer = gitVersionOutput["FullSemVer"].ToString();
168-
AppVeyor.UpdateBuildVersion(fullSemVer);
190+
AppVeyor.UpdateBuildVersion(appveyorBuildNumber);
169191
});
170192

171193
Task("__BuildSolutions")
@@ -188,33 +210,18 @@ Task("__BuildSolutions")
188210
Task("__RunTests")
189211
.Does(() =>
190212
{
191-
XUnit2("./src/**/bin/" + configuration + "/**/*.Net4*.Specs.dll", new XUnit2Settings {
192-
OutputDirectory = testResultsDir,
193-
XmlReportV1 = true
194-
});
195-
});
196-
197-
Task("__RunDotnetTests")
198-
.Does(() =>
199-
{
200-
foreach(var specsProj in GetFiles("./src/**/*.Specs.csproj")
201-
.Select(f => f.FullPath)
202-
.Where(f => f.Contains(netStandard))
203-
) {
204-
DotNetCoreTest(specsProj, new DotNetCoreTestSettings {
205-
Configuration = configuration,
206-
NoBuild = true
213+
foreach(var specsProj in GetFiles("./src/**/*.Specs.csproj")) {
214+
DotNetCoreTest(specsProj.FullPath, new DotNetCoreTestSettings {
215+
Configuration = configuration,
216+
NoBuild = true
207217
});
208218
}
209219
});
210220

211-
212-
Task("__CopyNonSignedOutputToNugetFolder")
221+
Task("__CopyOutputToNugetFolder")
213222
.Does(() =>
214223
{
215-
foreach(var project in projectToNugetFolderMap.Keys
216-
.Where(p => !p.Contains(signed))
217-
) {
224+
foreach(var project in projectToNugetFolderMap.Keys) {
218225
var sourceDir = srcDir + Directory(projectName + "." + project) + Directory("bin") + Directory(configuration);
219226

220227
foreach(var targetFolder in projectToNugetFolderMap[project]) {
@@ -228,49 +235,6 @@ Task("__CopyNonSignedOutputToNugetFolder")
228235
CopyFile(nuspecSrcFile, nuspecDestFile);
229236
});
230237

231-
Task("__CopySignedOutputToNugetFolder")
232-
.Does(() =>
233-
{
234-
foreach(var project in projectToNugetFolderMap.Keys
235-
.Where(p => p.Contains(signed))
236-
) {
237-
var sourceDir = srcDir + Directory(projectName + "." + project) + Directory("bin") + Directory(configuration);
238-
239-
foreach(var targetFolder in projectToNugetFolderMap[project]) {
240-
var destDir = buildDir + Directory("lib");
241-
242-
Information("Copying {0} -> {1}.", sourceDir, destDir);
243-
CopyDirectory(sourceDir, destDir);
244-
}
245-
}
246-
247-
CopyFile(nuspecSrcFile, nuspecSignedDestFile);
248-
249-
var replacedFiles = ReplaceRegexInFiles(nuspecSignedDestFile, "dependency id=\"(Polly\\S*)\"", "dependency id=\"$1-Signed\"");
250-
if (!replacedFiles.Any())
251-
{
252-
throw new Exception("Could not set Polly dependency to Polly-Signed, for -Signed nuget package.");
253-
}
254-
});
255-
256-
Task("__CreateNonSignedNugetPackage")
257-
.Does(() =>
258-
{
259-
var nugetVersion = gitVersionOutput["NuGetVersion"].ToString();
260-
var packageName = projectName;
261-
262-
Information("Building {0}.{1}.nupkg", packageName, nugetVersion);
263-
264-
var nuGetPackSettings = new NuGetPackSettings {
265-
Id = packageName,
266-
Title = packageName,
267-
Version = nugetVersion,
268-
OutputDirectory = nupkgDestDir
269-
};
270-
271-
NuGetPack(nuspecDestFile, nuGetPackSettings);
272-
});
273-
274238
Task("__StronglySignAssemblies")
275239
.Does(() =>
276240
{
@@ -290,8 +254,7 @@ Task("__StronglySignAssemblies")
290254
Task("__CreateSignedNugetPackage")
291255
.Does(() =>
292256
{
293-
var nugetVersion = gitVersionOutput["NuGetVersion"].ToString();
294-
var packageName = projectName + signed;
257+
var packageName = projectName;
295258

296259
Information("Building {0}.{1}.nupkg", packageName, nugetVersion);
297260

@@ -302,10 +265,9 @@ Task("__CreateSignedNugetPackage")
302265
OutputDirectory = nupkgDestDir
303266
};
304267

305-
NuGetPack(nuspecSignedDestFile, nuGetPackSettings);
268+
NuGetPack(nuspecDestFile, nuGetPackSettings);
306269
});
307270

308-
309271
//////////////////////////////////////////////////////////////////////
310272
// BUILD TASKS
311273
//////////////////////////////////////////////////////////////////////
@@ -318,10 +280,7 @@ Task("Build")
318280
.IsDependentOn("__UpdateAppVeyorBuildNumber")
319281
.IsDependentOn("__BuildSolutions")
320282
.IsDependentOn("__RunTests")
321-
.IsDependentOn("__RunDotnetTests")
322-
.IsDependentOn("__CopyNonSignedOutputToNugetFolder")
323-
.IsDependentOn("__CreateNonSignedNugetPackage")
324-
.IsDependentOn("__CopySignedOutputToNugetFolder")
283+
.IsDependentOn("__CopyOutputToNugetFolder")
325284
.IsDependentOn("__StronglySignAssemblies")
326285
.IsDependentOn("__CreateSignedNugetPackage");
327286

src/GlobalAssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System.Reflection;
22

3-
[assembly: AssemblyProduct("Polly.Caching.MemoryCache")]
3+
[assembly: AssemblyProduct("Polly.Caching.Memory")]
44
[assembly: AssemblyCompany("App vNext")]
5-
[assembly: AssemblyDescription("Polly.Caching.MemoryCache is a MemoryCache plug-in for the Polly CachePolicy. Polly is a library that allows developers to express resilience and transient fault handling policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner.")]
5+
[assembly: AssemblyDescription("Polly.Caching.Memory is a MemoryCache plug-in for the Polly CachePolicy. Polly is a library that allows developers to express resilience and transient fault handling policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner.")]
66
[assembly: AssemblyCopyright("Copyright (c) 2018, App vNext")]
77

88
#if DEBUG

src/Polly.Caching.MemoryCache.NetStandard13.Specs/Polly.Caching.MemoryCache.NetStandard13.Specs.csproj renamed to src/Polly.Caching.Memory.NetStandard13.Specs/Polly.Caching.Memory.NetStandard13.Specs.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
2020
<PackageReference Include="xunit" Version="2.2.0" />
2121
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
22-
<PackageReference Include="Polly" Version="5.9.0" />
2322

2423
</ItemGroup>
2524
<ItemGroup>
@@ -28,7 +27,7 @@
2827
</Compile>
2928
</ItemGroup>
3029
<ItemGroup>
31-
<ProjectReference Include="..\Polly.Caching.MemoryCache.NetStandard13\Polly.Caching.MemoryCache.NetStandard13.csproj" />
30+
<ProjectReference Include="..\Polly.Caching.Memory.NetStandard13\Polly.Caching.Memory.NetStandard13.csproj" />
3231
</ItemGroup>
33-
<Import Project="..\Polly.Caching.MemoryCache.SharedSpecs\Polly.Caching.MemoryCache.SharedSpecs.projitems" Label="Shared" />
32+
<Import Project="..\Polly.Caching.Memory.SharedSpecs\Polly.Caching.Memory.SharedSpecs.projitems" Label="Shared" />
3433
</Project>

0 commit comments

Comments
 (0)