Cache_lite trial _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Cache_lite trial. The cache_lite of pear is studied today. Download the latest cache_lite from pear.php.net. Cache_lite is a lightweight cache library class in the pear library class. Indeed light, the code has a total of four files. today we will study the cache_lite of pear.

Download the latest cache_lite from the http://pear.php.net. Cache_lite is a lightweight cache library class in the pear library class. It is really light, and the code has a total of 4 files. Lite. php cache/File. php cache/unction. php cache/output. php. In addition, the scalability is very good. you can add it to your own library class and modify the raiseError function of lite. php.

Add your own library class and start the test. First, the basic cache:

require_once('../libs/cache/Lite.php');

$id='1';
$options = array(
'cacheDir' => '../cache/test/',
'lifeTime' => 60
);
$cache=new Cache_Lite($options);
if($data=$cache->get($id)){
echo $data;
}else{
$data=time();
$cache->save($data);
echo $data;
}
?>


To make the test easier, I set the cache time to 1 minute. After running, you will find a file named Keystore in the ../cache/test/directory, which is the cache file generated by cache_lite. You will find that the data is encrypted. Of course, this is for the sake of security.
When you refresh the page, you will find that the page has not changed. This means that the cache takes effect. it's easy. ^_^. 1 minute later, refresh, haha, changed. In this way, the basic effect of cache is achieved.
Cache_lite can also implement function caching and other functions, I will not introduce the specific, you can access http://www.phpobject.net/blog/books/cache_lite.html

Bytes. Download the latest cache_lite from the http://pear.php.net. Cache_lite is a lightweight cache library class in the pear library class. Indeed light, the code has a total of 4 files...

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.