开发者

Kohana Cache Module not loading set servers (kohana 3.2)

开发者 https://www.devze.com 2023-03-31 19:19 出处:网络
I am having an issue with the Cache module Configuration. I have done the following: put Cache::$default = \'memcachetag\'; in bootstrap.php

I am having an issue with the Cache module Configuration.

I have done the following:

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

  2. copied modules/cache/config/config.php to application/config/config.php with the following config:

    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
      )
    );
    

The problem is the 'servers' are not being overridden so its always pulling from the modules config file 开发者_StackOverflow(host name is localhost always)

I am make an instance with Cache::instance() and checking the values with echo Debug::vars(Cache::instance());

Thanks in advance!


I solved this by creating a new Cache config group that was named different then all the others and then setting that as the default group in bootstrap.


Your file listing needs to be built up the same in all three layers of a Kohana project (system, modules and application) to allow for overloading of files.

So you need to put your overloaded config file in application/config/cache.php and not in modules/application/config.php. The cache config file is in modules/cache/config/cache.php so this file will get overloaded with your config file.

Look here: http://kohanaframework.org/3.2/guide/cache/config#group-settings

Below are the default cache configuration groups for each supported driver. Add to- or override these settings within the application/config/cache.php file.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号