I studied cache_lite again and read details about cache_lite at night, which is much more powerful than I thought. Of course, I have not found whether it supports directly saving PHP code for caching, but I think it can be extended.
Here are several examples:
Require_once ('../Libs/cache/Lite. php');
$ Options= Array ( 'Cachedir'=>'../Cache/test /', 'Filelocking'=>True, 'Writecontrol'=>True, 'Readcontrol'=>False, 'Filenameprotection'=>False,// Disable the file name security mode. The cache id and group name are directly applied to the name of the cache file, so be careful when using special characters. 'Icicserialization'=>False,// Disable automatic sequence 'Hasheddirectorylevel'=>2,// Set the two-level cache path 'Lifetime'=>60 ); $ Cache= NewCache_Lite($ Options); $ Id='Test';
If ($ Data=$ Cache->Get($ Id,'Test')){
Echo$ Data;
} Else { $ Data=Time(); $ Cache->Save($ Data);
Echo$ Data;
} ?>
If (! ($ Cache->Start('Id _ of_the_page'))){ // No Cache found! Echo'Test time :'.Time().'
Test
'; $ Cache->End();// The buffered output is now stored in a cache file. }
function function_to_bench($arg1, $arg2)
{
echo "This is the output of the function function_to_bench($arg1, $arg2) !
";
return "This is the result of the function function_to_bench($arg1, $arg2) !
";
} ?>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service