Index: trunk/include/xoops_block_cache.php
===================================================================
--- trunk/include/xoops_block_cache.php	(revision 36)
+++ trunk/include/xoops_block_cache.php	(revision 36)
@@ -0,0 +1,17 @@
+<?php
+	require_once dirname( __FILE__ ) .'/xml.php' ;
+	require_once dirname( __FILE__ ) .'/xpress_cache.php' ;
+	
+	function xpress_block_cache_write($mydirname,$block_name,$block)
+	{
+			$xml = XML_serialize($block);
+			$xml_name = $block_name . '.xml';
+			xpress_cache_write($mydirname,$xml_name,$xml);
+	}
+	function xpress_block_cache_read($mydirname,$block_name)
+	{
+			$xml_name = $block_name . '.xml';
+			$xml_data = xpress_cache_read($mydirname,$xml_name);
+			return @XML_unserialize($xml_data);
+	}
+?>
Index: trunk/include/xpress_cache.php
===================================================================
--- trunk/include/xpress_cache.php	(revision 36)
+++ trunk/include/xpress_cache.php	(revision 36)
@@ -0,0 +1,50 @@
+<?php
+	
+if(!function_exists("xpress_cache_read")):
+    function xpress_cache_read($mydirname,$collation_key)
+    {
+		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+		$cache_time = 0;
+        $filename = $cache_dir .$mydirname . '_' . $collation_key;
+//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) {
+        if (file_exists($filename)) {
+            return file_get_contents($filename);
+       } else {
+			return '';
+		}
+    } 
+endif;
+
+if(!function_exists("xpress_cache_write")):
+    function xpress_cache_write($mydirname,$collation_key,$content)
+    {
+		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+		$cache_time = 0;
+
+        $filename = $cache_dir .$mydirname . '_' . $collation_key;
+//        if ((time() - @filemtime($filename)) > $cache_time) {
+            $fp = fopen($filename, "w");
+            flock($fp, 2);
+            fputs($fp, $content);
+            fclose($fp);
+ //       } 
+    } 
+endif;
+
+if(!function_exists("xpress_block_cache_clear")):
+    function xpress_cache_clear($mydirname)
+    {
+		$cache_dir = XOOPS_ROOT_PATH . '/cache/';
+		$cache_time = 0;
+        if ($dh = opendir($cache_dir)) {
+            while (($file = readdir($dh)) !== false) {
+                if (preg_match('/^' . preg_quote($mydirname) . '/', $file)) {
+                    unlink($cache_dir.$file);
+                } 
+            } 
+            closedir($dh);
+        } 
+    } 
+endif;
+
+?>
