Skip to content

Commit 7378dea

Browse files
Set UriRelativeCacheKey as default and ensure it's registered
1 parent c46f56d commit 7378dea

4 files changed

Lines changed: 4 additions & 40 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<CacheKey>()
57+
.SetCacheKey<UriRelativeCacheKey>()
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<CacheKey>()
133+
.SetCacheKey<UriRelativeCacheKey>()
134134
.SetCacheHash<CacheHash>()
135135
.ClearProviders()
136136
.AddProvider<PhysicalFileSystemProvider>()

src/ImageSharp.Web/Caching/CacheKey.cs

Lines changed: 0 additions & 37 deletions
This file was deleted.

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<CacheKey>();
67+
builder.SetCacheKey<UriRelativeCacheKey>();
6868

6969
builder.SetCacheHash<CacheHash>();
7070

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public void DefaultServicesAreRegistered()
2323
Assert.Contains(services, x => x.ServiceType == typeof(FormatUtilities));
2424
Assert.Contains(services, x => x.ServiceType == typeof(IRequestParser) && x.ImplementationType == typeof(QueryCollectionRequestParser));
2525
Assert.Contains(services, x => x.ServiceType == typeof(IImageCache) && x.ImplementationType == typeof(PhysicalFileSystemCache));
26+
Assert.Contains(services, x => x.ServiceType == typeof(ICacheKey) && x.ImplementationType == typeof(UriRelativeCacheKey));
2627
Assert.Contains(services, x => x.ServiceType == typeof(ICacheHash) && x.ImplementationType == typeof(CacheHash));
2728
Assert.Contains(services, x => x.ServiceType == typeof(IImageProvider) && x.ImplementationType == typeof(PhysicalFileSystemProvider));
2829
Assert.Contains(services, x => x.ServiceType == typeof(IImageWebProcessor) && x.ImplementationType == typeof(ResizeWebProcessor));

0 commit comments

Comments
 (0)