2011-08-29 86 views
1

我有一个缓存模块配置的问题。Kohana缓存模块不加载设置服务器(kohana 3.2)

我也做了以下内容:

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

  2. 复制的模块/高速缓存/配置/ config.php中使用以下的配置应用/配置/ 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 
    ) 
    ); 
    

的问题是 '服务器' 是没有被覆盖所以它总是从模块的配置文件中拉(主机名始终是本地主机)

我做一个实例与Cache::instance(),并与回声Debug::vars(Cache::instance());

012检查值

提前致谢!

回答

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文件中的这些设置。

+0

对不起,我在我的文章中犯了一个错误,我确实在modules/application/config.php中设置了它,我可以更改'default_expire'=> 8000等值,并且它们显示已更改,但是当我更改服务器值被忽略,并使用本地主机 – Ian

+0

一些更多的信息 当我在modules/cache/config/cache.php中添加服务器它工作正常(我编辑了memcacetag配置数组) 当我做回声Devug :: vars (Kohana :: $ config-> load(cache)我没有看到我添加的服务器,我只看到localhost – Ian

+0

尽管如此,配置文件不应该在'modules/application/config.php'中,它们应该在'application/config/cache.php'。我不知道你的应用程序文件夹在哪里,但现在它不会重载模块的值乐。 – Luwe