Skip to content

[Fix][Routing] Bump route cache key version to v2#23

Merged
agissept merged 1 commit into
masterfrom
improvements/route-cache-version-v2
Jul 9, 2026
Merged

[Fix][Routing] Bump route cache key version to v2#23
agissept merged 1 commit into
masterfrom
improvements/route-cache-version-v2

Conversation

@agissept

@agissept agissept commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

Bumps the route cache key version from v1 to v2 in Illuminate\CachedRouting\Router.

What it fixes

The previous route caching came from maartenstaa/laravel-41-route-caching, which serialized MaartenStaa\Routing\Route objects under the cache key routes.cache.v1.<md5(path)><mtime>. After migrating to native Illuminate\CachedRouting, the new code reused the same key format. On deploy, the first request read the stale v1 blob and unserialize() produced __PHP_Incomplete_Class (class MaartenStaa\Routing\Route no longer exists), throwing:

The script tried to call a method on an incomplete object ... MaartenStaa\Routing\Route ... unserialize()

Fix

Changing cacheVersion to v2 produces a fresh key (routes.cache.v2.*). Old v1 blobs are never read again and expire on their own TTL (24h), while routes regenerate cleanly on the next request — no manual Redis purge required on future deploys.

🤖 Generated with Claude Code

Invalidates stale v1 route-cache blobs left by the previous
maartenstaa/laravel-41-route-caching package. Those blobs serialized
MaartenStaa\Routing\Route objects under the shared 'routes.cache.v1.*'
key; after switching to Illuminate\CachedRouting the first post-deploy
read of that key unserialized to __PHP_Incomplete_Class, causing
'call a method on an incomplete object' errors.

Bumping the version changes the cache key so old blobs are never read
again and routes regenerate cleanly on next request.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@agissept agissept merged commit 8f7ebac into master Jul 9, 2026
2 checks passed
@agissept agissept deleted the improvements/route-cache-version-v2 branch July 9, 2026 08:48
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