The php file cache class extracted from the CI community's stblog and CI's file_helper class, a simple file-based key->value cache class. This class can be used to cache some basic information, such as some infrequent changes in the header, footer, and sidebar of the blog, and the content taken out from the database. Before fetching the data, first determine whether the content in the file cache has expired. If it has not expired, take it out. , if it expires, connect to the database to query, rewrite the results into the file cache, and update the expiration time.
First download the php cache file class extracted from CI that we need to use in this course: //m.sbmmt.com/xiazai /leiku/478
After the download is complete, find the php class file we need, unzip it to our local directory, and create a new php file!
After completion, we need to call this class in the new php file and instantiate the class:
set('test','php中文网:m.sbmmt.com'); print $cache->get('test'); ?>
The running result is as shown below:
Create a cache folder below the directory, which contains our file cache:
The above is the detailed content of Instructions for using php cache files extracted from CI framework. For more information, please follow other related articles on the PHP Chinese website!