Skip to content

Commit 408610b

Browse files
committed
DRY
1 parent 9db0e6b commit 408610b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ImageSharp.Web.Providers.Azure/Caching/AzureBlobStorageCache.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public AzureBlobStorageCache(IOptions<AzureBlobStorageCacheOptions> cacheOptions
3636
/// <inheritdoc/>
3737
public async Task<IImageCacheResolver?> GetAsync(string key)
3838
{
39-
BlobClient blob = this.container.GetBlobClient(this.GetBlobName(key));
39+
BlobClient blob = this.GetBlob(key);
4040

4141
if (!await blob.ExistsAsync())
4242
{
@@ -49,7 +49,7 @@ public AzureBlobStorageCache(IOptions<AzureBlobStorageCacheOptions> cacheOptions
4949
/// <inheritdoc/>
5050
public Task SetAsync(string key, Stream stream, ImageCacheMetadata metadata)
5151
{
52-
BlobClient blob = this.container.GetBlobClient(this.GetBlobName(key));
52+
BlobClient blob = this.GetBlob(key);
5353

5454
BlobHttpHeaders headers = new()
5555
{
@@ -84,6 +84,6 @@ public static Response<BlobContainerInfo> CreateIfNotExists(
8484
PublicAccessType accessType)
8585
=> new BlobContainerClient(options.ConnectionString, options.ContainerName).CreateIfNotExists(accessType);
8686

87-
private string GetBlobName(string key)
88-
=> this.cacheFolder + key;
87+
private BlobClient GetBlob(string key)
88+
=> this.container.GetBlobClient(this.cacheFolder + key);
8989
}

0 commit comments

Comments
 (0)