Example #1
0
{
    echo "<!-- {$type} :  {$msg} -->\n";
}
// Include composer autoload
include_once "../../../../../vendor/autoload.php";
class TestDriver
{
    // include trait XCache Driver to allow method be called withour starting '_'
    use XCacheDriver;
    // Define yuor method with '_' to be available to xcache
    public function _currentTime()
    {
        return date('Y-m-d H:i:s');
    }
    public function _testOne($param = '')
    {
        return "Param={$param} , date=" . $this->currentTime();
    }
}
$test = new TestDriver();
echo HTMLCODE_HR;
echo "Cache started : " . $test->currentTime() . HTMLCODE_BR;
echo HTMLCODE_HR;
echo "TestOne (1): " . $test->testOne('Example') . HTMLCODE_BR;
echo HTMLCODE_HR;
echo "TestOne (2): " . $test->testOne(date('Y-m-d H:i')) . HTMLCODE_BR;
echo HTMLCODE_HR;
echo "TestOne (3): " . $test->testOne(date('Y-m-d H:i:s')) . HTMLCODE_BR;
echo HTMLCODE_HR;
echo "CurrentTime (nocache): " . $test->_currentTime() . HTMLCODE_BR;
echo HTMLCODE_HR;