FriendsOfSymfony / FOSJsRoutingBundle

A pretty nice way to expose your Symfony routing to client applications.
1.48k stars 261 forks source link

Implement WarmableInterface #360

Open bpolaszek opened 5 years ago

bpolaszek commented 5 years ago

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:

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?