mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-22 13:13:05 +02:00
Update APC and APCu
The maintained APCu extension is the previous APC extension without opcode caching. APC is as of this writing unmaintained.
This commit is contained in:
@@ -33,22 +33,22 @@ Example logic using APCu:
|
||||
{% highlight php %}
|
||||
<?php
|
||||
// check if there is data saved as 'expensive_data' in cache
|
||||
$data = apc_fetch('expensive_data');
|
||||
$data = apcu_fetch('expensive_data');
|
||||
if ($data === false) {
|
||||
// data is not in cache; save result of expensive call for later use
|
||||
apc_add('expensive_data', $data = get_expensive_data());
|
||||
apcu_add('expensive_data', $data = get_expensive_data());
|
||||
}
|
||||
|
||||
print_r($data);
|
||||
{% endhighlight %}
|
||||
|
||||
Note that prior to PHP 5.5, APC provides both an object cache and a bytecode cache. APCu is a project to bring APC's
|
||||
Note that prior to PHP 5.5, there was APC extension which provided both an object cache and a bytecode cache. The new APCu is a project to bring APC's
|
||||
object cache to PHP 5.5+, since PHP now has a built-in bytecode cache (OPcache).
|
||||
|
||||
### Learn more about popular object caching systems:
|
||||
|
||||
* [APCu](https://github.com/krakjoe/apcu)
|
||||
* [APC Functions](https://secure.php.net/ref.apc)
|
||||
* [APCu Documentation](https://www.php.net/apcu)
|
||||
* [Memcached](https://memcached.org/)
|
||||
* [Redis](https://redis.io/)
|
||||
* [WinCache Functions](https://secure.php.net/ref.wincache)
|
||||
|
Reference in New Issue
Block a user