-
Notifications
You must be signed in to change notification settings - Fork 17
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
Feature Request: Prevent Cache Expiration on high Server Load #347
Comments
Just wanted to comment that implementing this will be super simple once the work in #288 is complete. We can simply connect this to the new |
This is ready for work IMO.
|
A new utility was implemented in wpsharks/comet-cache-pro#127 /*
* System load averages.
*
* @since 15xxxx Adding cache directory statistics.
*
* @return array System load averages.
*/
$self->sysLoadAverages = function () use ($self) {
if (!is_null($averages = &$self->cacheKey('sysLoadAverages'))) {
return $averages; // Already cached these.
}
if (!$self->functionIsPossible('sys_getloadavg')) {
return ($averages = array());
}
if (!is_array($averages = sys_getloadavg()) || !$averages) {
return ($averages = array());
}
$averages = array_map('floatval', $averages);
$averages = array_slice($averages, 0, 3);
// i.e., 1m, 5m, 15m; see: <http://jas.xyz/1gWyJLt>
return $averages;
}; Example Usage$load_averages = $self->sysLoadAverages();
if ($load_averages) {
// 1 minute ago = (float) $load_averages[0];
// 5 minutes ago = (float) $load_averages[1];
// 15 minutes ago = (float) $load_averages[2];
} |
Next Pro Release Changelog:
|
ZenCache Pro v151002 has been released and includes changes from this GitHub Issue. See the v151002 release announcement for further details. This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#347). |
Requested on WordPress.org:
Such a feature, utilizing the PHP
sys_getloadavg()
function, would only work in non-Windows hosting platforms, but nevertheless we could detect ifsys_getloadavg()
works on the current platform and then provide options for letting a site owner configure a specific server-load at which Quick Cache should not allow cache expiration.Support threads referencing this issue
The text was updated successfully, but these errors were encountered: