Skip to content

Commit 0149b7b

Browse files
Optimize for when not using nested cache folders
1 parent d5218c4 commit 0149b7b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/ImageSharp.Web/Caching/PhysicalFileSystemCache.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ private string ToImageFilePath(string path, in ImageCacheMetadata metaData)
152152
[MethodImpl(MethodImplOptions.AggressiveInlining)]
153153
internal static unsafe string ToFilePath(string key, int cacheFolderDepth)
154154
{
155+
if (cacheFolderDepth == 0)
156+
{
157+
// Short-circuit when not nesting folders
158+
return key;
159+
}
160+
155161
int length;
156162
int nameStartIndex;
157163
if (cacheFolderDepth >= key.Length)

0 commit comments

Comments
 (0)