我的缓存模块配置有问题。
我做了以下的事情:
-
用以下配置复制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 ) );
put Cache::$default
= 'memcachetag';在bootstrap.php
问题是'服务器'没有被覆盖,所以它总是从模块配置文件(主机名是localhost总是)拉
我用Cache::instance()
创建了一个实例,并使用echo Debug::vars(Cache::instance());
检查值
提前感谢!
我通过创建一个新的缓存配置组来解决这个问题,该组的名称与所有其他组不同,然后将其设置为bootstrap中的默认组。
您的文件清单需要在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文件中添加或覆盖这些设置。