-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support closures when using cache #141
Comments
the error message sounds like you try to serialize()/var_export() a Closure object which seems to not support this kind of operation. |
I found that it has that when I use handler as a function. It is normal when I use handler as a string. Is there any way to fix this? This has error:
This works well:
|
for the "builtin php Closures are not serializable" problem, exists a separate lib your caching adapter needs to take care of that, in case you really wanne cache such Closure style routes. |
A possible workaround that avoids super_closure:
In any case, the README should explicitly mention that closures as handlers cannot be cached. |
Accepting closure serialization (@staabm) or explicitly mentioning it unsupported inda doc (@nikic)? Why not adding flexibility to the $handler parameter (as strictness remains not de rigueur while using php) ? |
@smallfish500 we should mention it in the docs for sure. For v2.0 we need to look at which approach to take to make things cacheable. I'd say having the map sounds more appealing to me than introducing new dependencies but we need to explore these options and benchmark things. |
I got an error when I use cachedDispatcher, I is normal when I use simpleDispatcher
The error is:
This is my code:
The text was updated successfully, but these errors were encountered: