我是php和cakephp的新手,最近我被分配了一份工作来在我的应用程序中实现memcache,以便提高其性能。谁能为我建议一些关于这个主题的文档? 感谢。
答案 0 :(得分:3)
这可能有点晚了......但Cake核心支持内置的Memcached(至少在最新版本2.0.x和2.1中)。
在您的应用中查看Config / core.php,您应该看到这些行(已注释):
Cache::config('default', array(
'engine' => 'Memcache', //[required]
'duration' => 3600, //[optional]
'probability' => 100, //[optional]
'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
'servers' => array(
'127.0.0.1:11211' // localhost, default port 11211
), //[optional]
'persistent' => true, // [optional] set this to false for non-persistent connections
'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory)
));
您可以取消注释这些行并使用Memcached安装进行测试。确保在某处(localhost或其他地方)安装了Memcached,并指向它。
答案 1 :(得分:2)
Memcache是内置Cache类支持的Cache引擎之一。 Cache类是用于与您的Cache进行交互的包装器,您可以在此处阅读有关它的所有内容:http://book.cakephp.org/2.0/en/core-libraries/caching.html
答案 2 :(得分:1)
术士
这是一个更具体的Memcache和Cakephp实现,可以帮助你的瓶颈
使用CakePHP + Memcached
在度假时发送数据库