New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support to cache the config file #14617
Conversation
As discussed we're wanting to give this a try. |
|
||
private function makeCacheDir($host) | ||
{ | ||
return PIWIK_INCLUDE_PATH . '/tmp/' . $host . '/cache/tracker'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check somewhere if this directory is writable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diosmosis the directory might only be created when actually caching a file (the file backend does that). We already check if PIWIK_INCLUDE_PATH . '/tmp/'
is writable as part of the system check not sure if it's enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like enough 👍
refs #14367
This supports caching the config ini file. It would be enabled through
$matomoDir/bootstrap.php
by putting this code in there (we cannot use DI or config file for this because they don't exist at the time of the config loading):It would pretty much only work for single server environments... all others would have the problem that the cache invalidation when the config changes wouldn't be synced. Also we do not want to have to document that users need to invalidate the cache when they make changes to it. It would pretty much only help us and I would probably not even document it. When loaded from a regular filesystem, it should be still very fast with the regular ini. If it works nicely, we could document it eventually.
By caching it, it would come from opcache instead of filesystem... and we would not need to do things like all these decodings etc https://github.com/matomo-org/component-ini/blob/master/src/IniReader.php#L149-L384
Any thoughts on this @mattab
refs DEV-1692