FOSJsRoutingBundle
FOSJsRoutingBundle copied to clipboard
Implement WarmableInterface
Hey there,
I just figured out that calling the fos_js_routing_js will trigger a cache write in the %kernel.project_dir%/var/cache/%kernel.environment%/fosJsRouting directory (which doesn't exist in case of a cache miss).
This has 2 drawbacks:
- Routes have to be computed during the user's request, which can impact performance even if it should be done only 1 time per deployment
- The system user running the PHP SAPI may not have writing permissions on the cache directory.
Why not implementing a Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface service which would hook on the cache:clear and the cache:warmup commands to write everything needed during deployment and/or cache clear/warmup?
Pre-requisites are prior knowledge of all the locales used but this can be achieved through the bundle configuration.
What are your thoughts?