Use route cache to store breadcrumb lists to speed things up
This version uses the route cache to not load all routes on every request:
-
On
cache:warmup
all breadcrumb lists for all routes are stored in the route cache. -
This speeds up the whole process of breadcrumb building since the getting of the whole
RouteCollection
triggers the router to reload all routes from filesystem every time. -
Breadcrumb config is ultimately stored in
_breadcrumbs
in a routesdefault
s. This, because options do not get cached. -
It uses a custom routing loader and replaces the existing
routing.loader
service by aliasingthormeier_breadcrumb.routing.attach_breadcrumb_loader
via compiler pass.If you are already replacing/extending the
routing.loader
service, use a compiler pass as well to make this work smooth!