Skip to content

Fix disk cache key collisions - #889

Open
kean wants to merge 1 commit into
mainfrom
fix/data-cache-key-collisions
Open

Fix disk cache key collisions#889
kean wants to merge 1 commit into
mainfrom
fix/data-cache-key-collisions

Conversation

@kean

@kean kean commented Aug 15, 2026

Copy link
Copy Markdown
Owner

ImageProcessors.Composition.identifier and makeDataCacheKey(for:) concatenated identifiers with no separator, so requests like ["resize-", "largeblur"] and ["resize-large", "blur"] produced the same disk cache key and the second one was served the first one's processed bytes. The same applied to the imageID/thumbnail/processors boundaries. The memory cache didn't have this bug, so the two cache layers disagreed.

Both now join their components with a + separator (always emitted, so empty components can't alias either).

Note: this changes the on-disk cache key format, so existing disk cache entries become unreachable - they simply miss, get re-fetched, and are reclaimed by the normal DataCache sweep.

Processor identifiers and the request components were concatenated without
a separator, so different requests could produce the same disk cache key
and be served the wrong processed image.
@kean kean added this to the 14.0 milestone Aug 15, 2026
@kean

kean commented Aug 15, 2026

Copy link
Copy Markdown
Owner Author

This is a breaking change. I'd need a migration step to drop the current cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant