2020-12-30 14:52

Cache routes

I've been wondering if there's an easy way to cache our routes. I know that laravel does this and symfony's router component has a cacheDir parameter too and it seems to have an impact on performance.

I'm posting this because my test case, which is nothing else than a die() in a controller method, 20% of the time is consumed by the routes. That's for a site with almost nothing in it, adding a few more single pages makes things even slower.

It doesn't seem to be super easy as we can dynamically add new routes, but even if I'd just cache the routes loaded from the config file, I could reduce the TTFB by 8%. Does anyone have more experience with symfony routing and can help me to get on the right track to build a complete route cache system?


part of https://github.com/concrete5/concrete5/issues/3287


  • 点赞
  • 回答
  • 收藏
  • 复制链接分享