-
Notifications
You must be signed in to change notification settings - Fork 18
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: Total Cache Size on Disk Statistics #83
Comments
Great idea! I'll accept this and add it to my list. Thanks! |
+1 |
Adding this to the Future Release milestone to work on next, after the Next Release. |
Two helpful methods from the WSC that might help when it comes time to implement this. /**
* Abbreviated byte notation for file sizes.
*
* @param float $bytes File size in bytes. A (float) value.
* We need this converted to a (float), so it's possible to deal with numbers beyond that of an integer.
*
* @param integer $precision Number of decimals to use.
*
* @return string Byte notation.
*/
public function bytes_abbr($bytes, $precision = 2)
{
$bytes = (float)$bytes;
$precision = (integer)$precision;
$precision = ($precision >= 0) ? $precision : 2;
$units = array('bytes', 'kbs', 'MB', 'GB', 'TB');
$bytes = ($bytes > 0) ? $bytes : 0;
$power = floor(($bytes ? log($bytes) : 0) / log(1024));
$abbr_bytes = round($bytes / pow(1024, $power), $precision);
$abbr = $units[min($power, count($units) - 1)];
if($abbr_bytes === (float)1 && $abbr === 'bytes')
$abbr = 'byte'; // Quick fix here.
else if($abbr_bytes === (float)1 && $abbr === 'kbs')
$abbr = 'kb'; // Quick fix here.
return $abbr_bytes.' '.$abbr;
}
/**
* Converts an abbreviated byte notation into bytes.
*
* @param string $string A string value in byte notation.
*
* @return float A float indicating the number of bytes.
*/
public function abbr_bytes($string)
{
$string = (string)$string;
$notation = '/^(?P<value>[0-9\.]+)\s*(?P<modifier>bytes|byte|kbs|kb|k|mb|m|gb|g|tb|t)$/i';
if(!preg_match($notation, $string, $_op))
return (float)0;
$value = (float)$_op['value'];
$modifier = strtolower($_op['modifier']);
unset($_op); // Housekeeping.
switch($modifier) // Fall through based on modifier.
{
case 't': // Multiplied four times.
case 'tb':
$value *= 1024;
case 'g': // Multiplied three times.
case 'gb':
$value *= 1024;
case 'm': // Multiple two times.
case 'mb':
$value *= 1024;
case 'k': // One time only.
case 'kb':
case 'kbs':
$value *= 1024;
}
return (float)$value;
} |
Related discussion here that might offer some ideas. |
Punting this to the Future Release milestone. |
Don't forget to put an option to completely disable this for customers who don't want this feature in use in order to save on resource usage. |
…tats collection. See: wpsharks/comet-cache#83
…tats collection. See: wpsharks/comet-cache#83
- Enhancing DirStats class. - Improving organization of SCSS files. - Improving cache directory utilities; integrating DirStats where applicable. - Implementing Admin Bar Directory Stats. - Improving AJAX clear/wipe cache interaction. - Creating `cleanupCache()` method to give the CRON cleanup a method of its own. - Improving PostloadUtils, excluding all plugin actions from automatic user cache clearing. This was already the case (for the most), but this change allows us to pick up ALL plugin actions. - Build `zc-` prefixed files using `SHORT_NAME` for easier branding. - Removing FontAwesome dependency in favor of Sharkicons. - Updating to the latest release of Sharkicons and integrating this w/ ZenCache. - Adding `wurgeCache()` and `autoWurgeCache()` for global cache purging. See: wpsharks/comet-cache#83 and wpsharks/comet-cache#127
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 (#83). |
I'd like to see a graphical disk usage meter in the Dashboard (perhaps even in the admin bar too)... which shows the current total disk space consumed by Quick Cache at the present time. Or, if that's not feasible (i.e. too resource intensive) it could be updated every X minutes or so.
I think it should be a pro feature myself.
The text was updated successfully, but these errors were encountered: