Index: /trunk/admin/common-zh-simplified-utf-8.lang.php
===================================================================
--- /trunk/admin/common-zh-simplified-utf-8.lang.php	(revision 520)
+++ /trunk/admin/common-zh-simplified-utf-8.lang.php	(revision 521)
@@ -71,4 +71,6 @@
 		'GC'
 		=> 'GC',
+		'Total'
+		=> '总共',
 		'Cache'
 		=> '缓冲区',
Index: /trunk/admin/common-zh-traditional-utf-8.lang.php
===================================================================
--- /trunk/admin/common-zh-traditional-utf-8.lang.php	(revision 520)
+++ /trunk/admin/common-zh-traditional-utf-8.lang.php	(revision 521)
@@ -71,4 +71,6 @@
 		'GC'
 		=> 'GC',
+		'Total'
+		=> '总共',
 		'Cache'
 		=> '快取',
Index: /trunk/admin/xcache.css
===================================================================
--- /trunk/admin/xcache.css	(revision 520)
+++ /trunk/admin/xcache.css	(revision 521)
@@ -18,6 +18,4 @@
 .button { }
 span.sortarrow { color: white; text-decoration: none; }
-.freeblocks { float: left; margin-right: 4px;}
-.freeblocks td { text-align: right; }
 form {margin: 0; padding: 0}
 
@@ -26,7 +24,7 @@
 .percent .pavail { background: green; }
 
-.usagegraph { height: 16px; }
-.usagegraph div { float: left; height: 3px; width: 4px; border: solid gray; border-width: 0 0px 1px 0; }
-.usagegraph { border: 1px solid gray; border-bottom: 0px; }
+.freeblockgraph { height: 16px; }
+.freeblockgraph div { float: left; height: 3px; width: 4px; border: solid gray; border-width: 0 0px 1px 0; }
+.freeblockgraph { border: 1px solid gray; border-bottom: 0px; }
 
 .switcher, h1, h2 { text-align: center; display: block; }
Index: /trunk/admin/xcache.php
===================================================================
--- /trunk/admin/xcache.php	(revision 520)
+++ /trunk/admin/xcache.php	(revision 521)
@@ -169,5 +169,13 @@
 		$cacheid = (int) (isset($_POST['cacheid']) ? $_POST['cacheid'] : 0);
 		if (isset($_POST['clearcache'])) {
-			xcache_clear_cache($type, $cacheid);
+			$count = xcache_count($type);
+			if ($cacheid == $count) {
+				for ($cacheid = 0; $cacheid < $count; $cacheid ++) {
+					xcache_clear_cache($type, $cacheid);
+				}
+			}
+			else {
+				xcache_clear_cache($type, $cacheid);
+			}
 		}
 	}
@@ -177,4 +185,5 @@
 // {{{ load info/list
 $cacheinfos = array();
+$total = array();
 for ($i = 0; $i < $pcnt; $i ++) {
 	$data = xcache_info(XC_TYPE_PHP, $i);
@@ -186,5 +195,33 @@
 	$data['cacheid'] = $i;
 	$cacheinfos[] = $data;
-}
+	if ($pcnt >= 2) {
+		foreach ($data as $k => $v) {
+			switch ($k) {
+			case 'type':
+			case 'cache_name':
+			case 'cacheid':
+			case 'free_blocks':
+				continue 2;
+			}
+			if (!isset($total[$k])) {
+				$total[$k] = $v;
+			}
+			else {
+				$total[$k] += $v;
+			}
+		}
+	}
+}
+
+if ($pcnt >= 2) {
+	$total['type'] = XC_TYPE_PHP;
+	$total['cache_name'] = _T('Total');
+	$total['cacheid'] = $pcnt;
+	$total['gc'] = null;
+	$total['istotal'] = true;
+	$cacheinfos[] = $total;
+}
+
+$total = array();
 for ($i = 0; $i < $vcnt; $i ++) {
 	$data = xcache_info(XC_TYPE_VAR, $i);
@@ -196,4 +233,31 @@
 	$data['cacheid'] = $i;
 	$cacheinfos[] = $data;
+	if ($pcnt >= 2) {
+		foreach ($data as $k => $v) {
+			switch ($k) {
+			case 'type':
+			case 'cache_name':
+			case 'cacheid':
+			case 'free_blocks':
+			case 'gc':
+				continue 2;
+			}
+			if (!isset($total[$k])) {
+				$total[$k] = $v;
+			}
+			else {
+				$total[$k] += $v;
+			}
+		}
+	}
+}
+
+if ($vcnt >= 2) {
+	$total['type'] = XC_TYPE_VAR;
+	$total['cache_name'] = _T('Total');
+	$total['cacheid'] = $vcnt;
+	$total['gc'] = null;
+	$total['istotal'] = true;
+	$cacheinfos[] = $total;
 }
 // }}}
@@ -210,4 +274,7 @@
 	}
 	foreach ($cacheinfos as $i => $c) {
+		if (!empty($c['istotal'])) {
+			continue;
+		}
 		if ($c['type'] == $type && isset($c['cache_list'])) {
 			foreach ($c['cache_list'] as $e) {
Index: /trunk/admin/xcache.tpl.php
===================================================================
--- /trunk/admin/xcache.tpl.php	(revision 520)
+++ /trunk/admin/xcache.tpl.php	(revision 521)
@@ -51,7 +51,13 @@
 		$pused = 100 - $pavail;
 
-		$graph = freeblock_to_graph($ci['free_blocks'], $ci['size']);
 		$w = $free_graph_width;
 		$tdwidth = $w + 2;
+		if (empty($ci['istotal'])) {
+			$graph = freeblock_to_graph($ci['free_blocks'], $ci['size']);
+			$freeblockgraph = "<div class=\"freeblockgraph\" style=\"width: {$w}px\">{$graph}</div>";
+		}
+		else {
+			$freeblockgraph = '';
+		}
 
 		$ci_slots = size($ci['slots']);
@@ -59,6 +65,12 @@
 		$ci_avail = size($ci['avail']);
 		$ci = number_formats($ci, $numkeys);
-		$ci['compiling']    = $ci['type'] == $type_php ? ($ci['compiling'] ? 'yes' : 'no') : '-';
-		$ci['can_readonly'] = $ci['can_readonly'] ? 'yes' : 'no';
+		if (!empty($ci['istotal'])) {
+			$ci['compiling']    = '-';
+			$ci['can_readonly'] = '-';
+		}
+		else {
+			$ci['compiling']    = $ci['type'] == $type_php ? ($ci['compiling'] ? 'yes' : 'no') : '-';
+			$ci['can_readonly'] = $ci['can_readonly'] ? 'yes' : 'no';
+		}
 		echo <<<EOS
 		<th>{$ci['cache_name']}</th>
@@ -71,6 +83,5 @@
 				><div style="width: {$pused}%" class="pused"></div
 			></div
-			><div class="usagegraph" style="width: {$w}px">{$graph}</div
-		></td>
+		>{$freeblockgraph}</td>
 		<td
 			><form method="post"
