APC Full name alternative PHP cache, can be cached PHP source files, can also cache user data, the following we install him, see how to query cache, modify cache, delete cache and other functions
memory of the previous PHP file uploaded to the server need to use Zend Guard encryption, with APC on it. The message from Wikipedia is that the APC will be built into the PHP6, so the APC is still worth learning. 1, installation extension in Ubuntu 12.04 can be installed directly through the Apt-get install PHP-APC installation APC expansion. On the Windows system, the author has previously installed in Windows APC, but the operation is not stable, do not know now resolved not. In Windows can replace APC with Wincache, Microsoft developed itself, 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 This script can view the use of APC. The interface is as follows: There are two tabs that have a little bit of attention: 1 System cache Entries: This means caching options for caching some PHP files in the middle code. 2 User Cache Entries: Represents the caching of user data, in which the user's data can be cached to APC. If you want to view the user data cache, you need to first modify the access account and password. Open the apc.php file, find the following two lines of code to modify it: The code is as follows: Defaults (' Admin_username ', ' APC '); Admin Username defaults (' Admin_password ', ' PASSWORD '); Admin password-change this to ENABLE!!! 3, APC Use example APC is very simple, look at the following several additions, queries, modifications, delete examples. Add a cache with a valid time of 3,600 seconds code as follows: Apc_add (' name ', ' Tom ', 3600); Execute the code, and then look at the user cache Entries, and you can see one more cached data with a key value of name: There are hit times, size, expiration time, and so on. Query cache code as follows: Apc_add (' name ', ' Tom ', 3600); Print Apc_fetch (' name '); Output Tom Modify cache code as follows: Apc_store (' name ', ' Anny ', 3600); Print Apc_fetch (' name '); Output Anny Delete cache code as follows: Apc_delete (' name '); Var_dump (Apc_fetch (' name ')); output bool (false) decreasing number If the contents of the cache are numbers, you can use APC_ Inc to 1,apc_dec self minus 1. Code as follows: Apc_add (' num ', 10); Apc_inc (' num '); Print apc_fetch (' num ');//Output one apc_dec (' num '); Print apc_fetch (' num ')//output to determine whether the cache exists code as follows: Apc_add (' name ', ' Tom ', 3600); Var_dump (apc_exists (' name ')); output bool (TRUE) Var_dump (apc_exists (' age ')); BOOL (FALSE)