Kohana缓存模块未加载集服务器(kohana 3.2)

时间:2011-08-29 20:09:27

标签: php kohana kohana-3 kohana-cache

我遇到了缓存模块配置问题。

我做了以下事情:

  1. put Cache::$default ='memcachetag';在bootstrap.php中

  2. 使用以下配置将modules / cache / config / config.php复制到application / config / config.php:

    return array(
      // Override the default configuration
      'memcachetag'   => array(
        'driver'         => 'memcachetag',  // Use Memcached as the default driver
        'default_expire' => 8000,        // Overide default expiry
        'servers'        => array(
           // Add a new server
           array(
             'host'       => 'server',
             'port'       => 11211,
             'persistent' => FALSE
           )
        ),
        'compression'    => FALSE
      )
    );
    
  3. 问题是'服务器'没有被覆盖所以它总是从模块配置文件中提取(主机名总是localhost)

    我使用Cache::instance()创建一个实例并使用echo Debug::vars(Cache::instance());

    检查值

    提前致谢!

2 个答案:

答案 0 :(得分:1)

我通过创建一个新的Cache配置组来解决这个问题,该配置组的名称与所有其他组件不同,然后将其设置为bootstrap中的默认组。

答案 1 :(得分:0)

您的文件列表需要在Kohana项目的所有三个层(系统,模块和应用程序)中相同构建,以允许文件重载。

因此,您需要将重载的配置文件放在application/config/cache.php而不是modules/application/config.php中。缓存配置文件位于modules/cache/config/cache.php中,因此该文件将因配置文件而过载。

请看这里:http://kohanaframework.org/3.2/guide/cache/config#group-settings

  

以下是每个支持的驱动程序的默认缓存配置组。在 application / config / cache.php 文件中添加或覆盖这些设置。