php - 如何在 PHP 中使用 multiget 和 memcache

标签 php caching memcached

就像标题一样,来自内存缓存的多重获取是什么样子的?

这是使用 multiget 的正确方法吗? :

$memcache_obj = new Memcache;
$memcache_obj->connect('memcache_host', 11211);
$var = $memcache_obj->get(Array('some_key', 'second_key'));

谢谢

更新:任何想做同样事情的人,也请查看此添加:http://www.craigiam.com/blog/19/memcached-multiget-using-php-pecl-memcache-class

非常感谢 Pascal_Martin 解决了这个问题!

最佳答案

考虑到 Memcache::get接受一个键或一组键作为它的第一个参数,我会说它是;-)


引用:

You can pass array of keys to Memcache::get() to get array of values.
The result array will contain only found key-value pairs.

关于php - 如何在 PHP 中使用 multiget 和 memcache,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2733319/

相关文章:

caching - Appfabric缓存: Configuration Provider as single point of failure

azure - 选项卡 'Caching Rules' 在 Azure Blob 存储中消失了?

performance - 最快的 Smarty 缓存处理程序

php - session_start() : Write of lock failed

php - 我一直收到购物车是空的....?

php - Symfony 3/APCu + PHP7

php - Symfony2 中依赖注入(inject)的最佳实践

php - 无法查看laravel中的数据集合

c# - 自安装内存缓存 - 它存在吗?

django - memcached 减慢网站速度