Dancer2 icon indicating copy to clipboard operation
Dancer2 copied to clipboard

Route cache

Open DavsX opened this issue 11 years ago • 3 comments

Hi! I've noticed this #TODO comment in Dancer2::Core::App about using a route cache. Is somebody working on that && should we discuss it (would it be doable and useful)? I'd think we could use some kind of path_info => route_object kind of cache to speed up dispatching, however I'm unsure about how to proceed in case of route's, which use pass (i.e. chained routes).

Also, should we consider keeping the cache from overgrowing?

Ideas?

DavsX avatar Jan 02 '15 10:01 DavsX

Route caching has been a feature in Dancer 1. It was deemed worthwhile enough to promote it as the default in scaffolded apps. Unfortunately it hasn't been ported to Dancer 2.

I'm not sure it's that useful, and we should probably do some benchmarks before we work on it.

It's important to note that we should first change the registry structure and only then look at caching, because changing the registry structure had a suggestion in providing some caching there too, so it might render this redundant.

xsawyerx avatar Jan 05 '15 20:01 xsawyerx

Has there been any news on this? What was planned for the registry structure? Thanks

rleir avatar Dec 29 '15 12:12 rleir

@rleir Props for keeping the issue alive!

The new registry structure should focus first on the path, then on the method. This will allow producing better results when the path is available but the method is not (which should return 405 for Method not Available).

I'm not sure what I was thinking regarding the comment I made about a possible cache once we do the restructure of the registry, to be honest.

To be honest, I don't think we have to wait for the restructure in order to implement the cache, but we should probably have some statistics to show if it's worthwhile to add it.

xsawyerx avatar Jan 03 '16 18:01 xsawyerx