In this tutorial you will learn how to manage cache in PHP APC. I will explain the PHP APC functions apc_cache_info, apc_sma_info and apc_clear_cache.
Code used during this tutorial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# PHP APC Manage cache # PHP scripts used apc_cache_info.php apc_sma_info.php apc_clear_cache.php apc_store.php apc_fetch.php # Cached data are ttl-based and persists until HTTP web server/system reboot # Restart Apache HTTP web server sudo service apache2 restart Useful links: http://php.net/manual/en/function.apc-cache-info.php http://php.net/manual/en/function.apc-sma-info.php http://php.net/manual/en/function.apc-clear-cache.php http://php.net/manual/en/function.apc-store.php http://php.net/manual/en/function.apc-fetch.php |
1 2 3 4 5 6 7 8 |
<?php /** * apc_cache_info * Retrieves cached information from APC's data store * http://php.net/manual/en/function.apc-cache-info.php */ var_dump(apc_cache_info()); ?> |
1 2 3 4 5 6 7 8 9 |
<?php /** * apc_sma_info * Retrieves APC's Shared Memory Allocation information * http://php.net/manual/en/function.apc-sma-info.php */ echo '<pre>'; print_r(apc_sma_info()); ?> |
1 2 3 4 5 6 7 8 |
<?php /** * apc_clear_cache * Clears the APC cache * http://php.net/manual/en/function.apc-clear-cache.php */ apc_clear_cache(); ?> |
For apc_store.php and apc_fetch.php files checkout PHP APC Set and get cache values tutorial.
Useful links:
http://php.net/manual/en/function.apc-cache-info.php
http://php.net/manual/en/function.apc-sma-info.php
http://php.net/manual/en/function.apc-clear-cache.php
http://php.net/manual/en/function.apc-store.php
http://php.net/manual/en/function.apc-fetch.php
https://www.liviubalan.com/php-apc-set-and-get-cache-values