background image

8. eaccelerator_cache_result($key, $eval_code, $ttl=0)
   

 

将 $eval_code  

 

代 码的 执行 结果 缓存 $ttl 秒 ,( $ttl

 

参数 同 eacclerator_put ), 类似 

cache_output
   For Example:
  <?php eaccelerator_cache_result('test', ' time() . "Hello";', 30); ?>

9. eaccelerator_cache_page($key, $ttl=0)
  

 

将当前整页缓存 $ttl 秒。

  For Example:
  <?php
    eaccelerator_cache_page($_SERVER['PHP_SELF'].'?GET='.serialize($_GET),30);
    echo time();
    phpinfo();
  ?>

10. eaccelerator_rm_page($key)
  

  

删除由 eaccelerator_cache_page() 

 

执行的缓存,参数也是 $key

______________________________________________
(

 

作个简单例子看看它的威力,注意在 cli 模式下可能无效!)

<?php

class test_cache {

  var $pro = 'hello';

  function test_cache() {

    echo "Object Created!<br>\n";

  }

  function func() {

    echo ', the world!';

  }

  function now($t) {