ApcCache根据应用程序组件提供APC缓存。
要使用此应用程序组件,必须加载APC PHP扩展。或者,可以通过将useApcu设置为true来使用APCu PHP扩展。要为CLI启用APC或APCu,您应该在php.ini中添加“apc.enable_cli = 1”。
有关ApcCache支持的常见缓存操作,请参阅yii \ caching \ Cache。
我们看下其源码:
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\caching;
use yii\base\InvalidConfigException;
/**
* ApcCache provides APC caching in terms of an application component.
*
* To use this application component, the [APC PHP extension](http://www.php.net/apc) must be loaded.
* Alternatively [APCu PHP extension](http://www.php.net/apcu) could be used via setting `useApcu` to `true`.
* In order to enable APC or APCu for CLI you should add "apc.enable_cli = 1" to your php.ini.
*
* See [[Cache]] for common cache operations that ApcCache supports.
*
* For more details and usage information on Cache, see the [guide article on caching](guide:caching-overview).
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class ApcCache extends Cache
{
/**
* @var bool whether to use apcu or apc as the underlying caching extension.
* If true, [apcu](http://pecl.php.net/package/apcu) will be used.
* If f