I remember that in the past, when uploading php files to the server, you needed to use zend guard to encrypt them. With apc, you don’t need to. From the news seen on Wikipedia, apc will be built into php6, so apc is still worth learning.
1. Install extensions
In ubuntu 12.04, you can install the apc extension directly through apt-get install php-apc.
Regarding the windows system, the author has installed apc under windows before, but it ran unstable. I don’t know if it has been solved now. In Windows, you can use wincache instead of apc. It is developed by Microsoft itself and is very stable.
Tips: After the installation is complete, remember to restart the web server.
2. Download apc.php
Download address: apc_php.zip
apc.php is a script that can check the usage of apc. The interface is as follows:
There are two tabs that you can pay a little attention to:
1 System Cache Entries: This represents the system cache options, which are intermediate codes for caching some php files.
2 User Cache Entries: Represents the cache of user data. User data can be cached to apc during encoding. If you want to view the user data cache, you need to modify the access account and password first. Open the apc.php file, find the following two lines of code and modify them:
3. apc usage example
apc is very simple to use. See the following examples of adding, querying, modifying, and deleting.
Add a cache with a valid time of 3600 seconds
Execute the code, and then check the User Cache Entries. You can see that there is an additional cache data with the key value name:
It includes the number of hits, size, expiration time, etc.
Query Cache
Modify cache
Delete cache
Increasing and decreasing numbers
If the cached content is a number, you can use apc_ inc to increase by 1 and apc_dec to decrease by 1.
Check whether the cache exists