I have here a regular UI call, and it triggers more than 90
API.getSegmentMetadata calls which then triggers calls to funnels, heatmaps, goals, ... That's a site with like 50 segments.
This is executed here: https://github.com/matomo-org/matomo/blob/4.5.0-b1/core/Segment.php#L186-L194
It's cached in a property but we often create a new segment instance like
new Piwik/Segment(). So the cache isn't really used and for every segment we create a new instance and fetch segment metadata over and over again.
The goal of this issue is to have a cache be reused across segment instances. Meaning when a new segment instance is created, and we fetched this data previously, then it should reuse the cache from the other instance. The data may need to be cached per site and maybe other criteria.
This all can be quite slow.
@tsteur ah, I think the problem is getTransientCache won't be persisted between requests, and other caches won't accept closure. return segment has some closure. I guess we need some kind of format to format the data that translate the data, to be cached.
@tsteur feel free to reopen (or open a new issues), if we should work on a solution using a cache that persists between requests somewhen later.