Skip to content

Commit eee0259

Browse files
Fix naming and samples
1 parent a32fe63 commit eee0259

7 files changed

Lines changed: 20 additions & 20 deletions

File tree

samples/ImageSharp.Web.Sample/Startup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void ConfigureServices(IServiceCollection services)
5454
provider.GetRequiredService<IOptions<ImageSharpMiddlewareOptions>>(),
5555
provider.GetRequiredService<FormatUtilities>());
5656
})
57-
.SetCacheKey<UriRelativeCacheKey>()
57+
.SetCacheKey<UriRelativeLowerInvariantCacheKey>()
5858
.SetCacheHash<CacheHash>()
5959
.AddProvider<PhysicalFileSystemProvider>()
6060
.AddProcessor<ResizeWebProcessor>()
@@ -130,7 +130,7 @@ private void ConfigureCustomServicesAndCustomOptions(IServiceCollection services
130130
provider.GetRequiredService<IOptions<ImageSharpMiddlewareOptions>>(),
131131
provider.GetRequiredService<FormatUtilities>());
132132
})
133-
.SetCacheKey<UriRelativeCacheKey>()
133+
.SetCacheKey<UriRelativeLowerInvariantCacheKey>()
134134
.SetCacheHash<CacheHash>()
135135
.ClearProviders()
136136
.AddProvider<PhysicalFileSystemProvider>()

src/ImageSharp.Web/Caching/UriAbsoluteCaseInsensitiveCacheKey.cs renamed to src/ImageSharp.Web/Caching/UriAbsoluteLowerInvariantCacheKey.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace SixLabors.ImageSharp.Web.Caching
99
/// <summary>
1010
/// Creates a case insensitive cache key based on the request host, path and commands.
1111
/// </summary>
12-
public class UriAbsoluteCaseInsensitiveCacheKey : ICacheKey
12+
public class UriAbsoluteLowerInvariantCacheKey : ICacheKey
1313
{
1414
/// <inheritdoc/>
1515
public string Create(HttpContext context, CommandCollection commands)

src/ImageSharp.Web/Caching/UriRelativeCaseInsensitiveCacheKey.cs renamed to src/ImageSharp.Web/Caching/UriRelativeLowerInvariantCacheKey.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace SixLabors.ImageSharp.Web.Caching
99
/// <summary>
1010
/// Creates a case insensitive cache key based on the request path and commands.
1111
/// </summary>
12-
public class UriRelativeCaseInsensitiveCacheKey : ICacheKey
12+
public class UriRelativeLowerInvariantCacheKey : ICacheKey
1313
{
1414
/// <inheritdoc/>
1515
public string Create(HttpContext context, CommandCollection commands)

src/ImageSharp.Web/DependencyInjection/ServiceCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private static void AddDefaultServices(
6464

6565
builder.SetCache<PhysicalFileSystemCache>();
6666

67-
builder.SetCacheKey<UriRelativeCaseInsensitiveCacheKey>();
67+
builder.SetCacheKey<UriRelativeLowerInvariantCacheKey>();
6868

6969
builder.SetCacheHash<CacheHash>();
7070

tests/ImageSharp.Web.Benchmarks/Caching/CacheKeyBenchmarks.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@ public class CacheKeyBenchmarks
2121
private static readonly ICacheKey LegacyV1CacheKey = new LegacyV1CacheKey();
2222
private static readonly ICacheKey UriRelativeCacheKey = new UriRelativeCacheKey();
2323
private static readonly ICacheKey UriAbsoluteCacheKey = new UriAbsoluteCacheKey();
24-
private static readonly ICacheKey UriRelativeCaseInsensitiveCacheKey = new UriRelativeCaseInsensitiveCacheKey();
25-
private static readonly ICacheKey UriAbsoluteCaseInsensitiveCacheKey = new UriAbsoluteCaseInsensitiveCacheKey();
24+
private static readonly ICacheKey UriRelativeLowerInvariantCacheKey = new UriRelativeLowerInvariantCacheKey();
25+
private static readonly ICacheKey UriAbsoluteLowerInvariantCacheKey = new UriAbsoluteLowerInvariantCacheKey();
2626

2727
[Benchmark(Baseline = true, Description = nameof(LegacyV1CacheKey))]
2828
public string CreateUsingBaseline() => LegacyV1CacheKey.Create(Context, Commands);
2929

3030
[Benchmark(Description = nameof(UriRelativeCacheKey))]
3131
public string CreateUsingUriRelativeCacheKey() => UriRelativeCacheKey.Create(Context, Commands);
3232

33-
[Benchmark(Description = nameof(UriRelativeCaseInsensitiveCacheKey))]
34-
public string CreateUsingUriRelativeCaseInsensitiveCacheKey() => UriRelativeCacheKey.Create(Context, Commands);
33+
[Benchmark(Description = nameof(UriRelativeLowerInvariantCacheKey))]
34+
public string CreateUsingUriRelativeLowerInvariantCacheKey() => UriRelativeCacheKey.Create(Context, Commands);
3535

3636
[Benchmark(Description = nameof(UriAbsoluteCacheKey))]
3737
public string CreateUsingUriAbsoluteCacheKey() => UriAbsoluteCacheKey.Create(Context, Commands);
3838

39-
[Benchmark(Description = nameof(UriAbsoluteCaseInsensitiveCacheKey))]
40-
public string CreateUsingUriAbsoluteCaseInsensitiveCacheKey() => UriAbsoluteCacheKey.Create(Context, Commands);
39+
[Benchmark(Description = nameof(UriAbsoluteLowerInvariantCacheKey))]
40+
public string CreateUsingUriAbsoluteLowerInvariantCacheKey() => UriAbsoluteCacheKey.Create(Context, Commands);
4141

4242
/*
4343
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000
@@ -51,9 +51,9 @@ public class CacheKeyBenchmarks
5151
|----------------------------------- |---------:|---------:|---------:|------:|--------:|-------:|----------:|
5252
| LegacyV1CacheKey | 666.8 ns | 13.22 ns | 14.14 ns | 1.00 | 0.00 | 0.1659 | 696 B |
5353
| UriRelativeCacheKey | 358.0 ns | 1.98 ns | 1.65 ns | 0.54 | 0.01 | 0.0706 | 296 B |
54-
| UriRelativeCaseInsensitiveCacheKey | 363.1 ns | 7.20 ns | 11.21 ns | 0.55 | 0.02 | 0.0706 | 296 B |
54+
| UriRelativeLowerInvariantCacheKey | 363.1 ns | 7.20 ns | 11.21 ns | 0.55 | 0.02 | 0.0706 | 296 B |
5555
| UriAbsoluteCacheKey | 490.3 ns | 5.14 ns | 4.80 ns | 0.74 | 0.02 | 0.0763 | 320 B |
56-
| UriAbsoluteCaseInsensitiveCacheKey | 475.4 ns | 4.18 ns | 3.71 ns | 0.71 | 0.02 | 0.0763 | 320 B |
56+
| UriAbsoluteLowerInvariantCacheKey | 475.4 ns | 4.18 ns | 3.71 ns | 0.71 | 0.02 | 0.0763 | 320 B |
5757
*/
5858

5959
private static HttpContext CreateContext()

tests/ImageSharp.Web.Tests/Caching/CacheKeyTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public class CacheKeyTests
1414
private static readonly ICacheKey LegacyV1CacheKey = new LegacyV1CacheKey();
1515
private static readonly ICacheKey UriRelativeCacheKey = new UriRelativeCacheKey();
1616
private static readonly ICacheKey UriAbsoluteCacheKey = new UriAbsoluteCacheKey();
17-
private static readonly ICacheKey UriRelativeCaseInsensitiveCacheKey = new UriRelativeCaseInsensitiveCacheKey();
18-
private static readonly ICacheKey UriAbsoluteCaseInsensitiveCacheKey = new UriAbsoluteCaseInsensitiveCacheKey();
17+
private static readonly ICacheKey UriRelativeLowerInvariantCacheKey = new UriRelativeLowerInvariantCacheKey();
18+
private static readonly ICacheKey UriAbsoluteLowerInvariantCacheKey = new UriAbsoluteLowerInvariantCacheKey();
1919

2020
[Fact]
2121
public void UriRelativeCacheKey_Is_Relative()
@@ -33,7 +33,7 @@ public void UriRelativeCacheKey_Is_Relative()
3333
}
3434

3535
[Fact]
36-
public void UriRelativeCaseInsensitiveCacheKey_Is_RelativeAndLowercase()
36+
public void UriRelativeLowerInvariantCacheKey_Is_RelativeAndLowercase()
3737
{
3838
HttpContext context = CreateHttpContext();
3939
var commands = new CommandCollection()
@@ -42,7 +42,7 @@ public void UriRelativeCaseInsensitiveCacheKey_Is_RelativeAndLowercase()
4242
};
4343

4444
const string expected = "/images/image-12345.jpeg?width=400";
45-
string actual = UriRelativeCaseInsensitiveCacheKey.Create(context, commands);
45+
string actual = UriRelativeLowerInvariantCacheKey.Create(context, commands);
4646

4747
Assert.Equal(expected, actual);
4848
}
@@ -63,7 +63,7 @@ public void UriAbsoluteCacheKey_Is_Absolute()
6363
}
6464

6565
[Fact]
66-
public void UriAbsoluteCaseInsensitiveCacheKey_Is_AbsoluteAndLowercase()
66+
public void UriAbsoluteLowerInvariantCacheKey_Is_AbsoluteAndLowercase()
6767
{
6868
HttpContext context = CreateHttpContext();
6969
var commands = new CommandCollection()
@@ -72,7 +72,7 @@ public void UriAbsoluteCaseInsensitiveCacheKey_Is_AbsoluteAndLowercase()
7272
};
7373

7474
const string expected = "testwebsite.com/images/image-12345.jpeg?width=400";
75-
string actual = UriAbsoluteCaseInsensitiveCacheKey.Create(context, commands);
75+
string actual = UriAbsoluteLowerInvariantCacheKey.Create(context, commands);
7676

7777
Assert.Equal(expected, actual);
7878
}

tests/ImageSharp.Web.Tests/DependencyInjection/ServiceRegistrationExtensionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void DefaultServicesAreRegistered()
4949
Assert.Single(services, IsService<FormatUtilities>);
5050
Assert.Single(services, IsServiceImplementationType<IRequestParser, QueryCollectionRequestParser>);
5151
Assert.Single(services, IsServiceImplementationType<IImageCache, PhysicalFileSystemCache>);
52-
Assert.Single(services, IsServiceImplementationType<ICacheKey, UriRelativeCacheKey>);
52+
Assert.Single(services, IsServiceImplementationType<ICacheKey, UriRelativeLowerInvariantCacheKey>);
5353
Assert.Single(services, IsServiceImplementationType<ICacheHash, CacheHash>);
5454
Assert.Single(services, IsServiceImplementationType<IImageProvider, PhysicalFileSystemProvider>);
5555
Assert.Single(services, IsServiceImplementationType<IImageWebProcessor, ResizeWebProcessor>);

0 commit comments

Comments
 (0)