【问题标题】:Cakephp Caching Configuration for ApcCache and MemcacheApcCache 和 Memcache 的 Cakephp 缓存配置
【发布时间】:2014-04-12 11:04:44
【问题描述】:

我正在使用 Cakephp 2.4.6,我想在我的应用程序中使用缓存。 在我的 Bootstrap.php 中我发现

                  Cache::config('default', array('engine' => 'File'));

在我的 core.php 中我找到了

             Cache::config('_cake_core_', array(
                                      'engine' => $engine,
                                      'prefix' => $prefix . 'cake_core_',
                                      'path' => CACHE . 'persistent' . DS,
                                      'serialize' => ($engine === 'File'),
                                      'duration' => $duration
                                   ));

为模型和数据源缓存配置缓存。这个缓存配置 用于存储模式描述和连接中的表列表。

                      Cache::config('_cake_model_', array(
                                    'engine' => $engine,
                                    'prefix' => $prefix . 'cake_model_',
                                    'path' => CACHE . 'models' . DS,
                                    'serialize' => ($engine === 'File'),
                                    'duration' => $duration
                                    ));

看完文档Cakephp Caching¶ 我试图在 Core.php 中配置 Apc Cach

                      Cache::config('default', array(
                                         'engine' => 'Apc',
                                       'duration'=> 9000,
                                           'probability'=> 100,
                                      'prefix' => Inflector::slug(APP_DIR) . '_',
                                     ));

显示错误

  Fatal error: Uncaught exception 'CacheException' with message 
       'Cache engine default is not properly configured.' in        C:\xampp\htdocs\go4add\lib\Cake\Cache\Cache.php:181 Stack trace: #0 

然后我尝试在 bootstrap.php 中进行配置,效果相同。 请帮帮我..我很困惑..

cakephp中是否需要安装Apc Cache和memcache? 如果需要,请告诉我如何在 nCakeph 中安装 Apc

【问题讨论】:

    标签: cakephp caching memcached apc


    【解决方案1】:

    不要碰任何东西。只需在第 352 行的 core.php 中将 $engine = 'File'; 更改为 $engine = 'Apc';。别忘了安装 Apc。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-07
      • 2012-08-20
      • 2020-03-16
      • 1970-01-01
      • 2012-12-03
      • 2012-09-06
      • 1970-01-01
      相关资源
      最近更新 更多