It seems that you're using URL as cache key, right? Things to be considered:
What's your cache backend?
Both of these considerations depend upon one's own project and what routes they want to cache. This example works best for data that only dependents on the URL and not any context like current user.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.