downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Memcached::setMultiByKey> <Memcached::setByKey
[edit] Last updated: Fri, 17 May 2013

view this page in

Memcached::setMulti

(PECL memcached >= 0.1.0)

Memcached::setMultiGuarda múltiples ítems

Descripción

public bool Memcached::setMulti ( array $items [, int $expiration ] )

Memcached::setMulti() es similar a Memcached::set(), pero en lugar de guardar una sola clave/valor en un ítem, funciona con múltiples ítems especificados en items. El tiempo de expiration se aplica a todos los ítems a la vez.

Parámetros

items

Un array de pares de clave/valor donde guardar en el servidor.

expiration

Tiempo de expiración, por defecto definido a 0. VeaTiempos de Expiración para más info info.

Valores devueltos

Devuelve TRUE en caso de éxito o FALSE en caso de error. Use Memcached::getResultCode() si es necesario.

Ejemplos

Ejemplo #1 Ejemplo de Memcached::setMulti()

<?php
$m 
= new Memcached();
$m->addServer('localhost'11211);

$items = array(
    
'key1' => 'value1',
    
'key2' => 'value2',
    
'key3' => 'value3'
);
$m->setMulti($itemstime() + 300);
?>

Ver también



add a note add a note User Contributed Notes Memcached::setMulti - [2 notes]
up
1
Nicolas
1 month ago
This is what the previous comment (fake set multi):

https://github.com/php-memcached-dev/php-memcached/blob/master/php_memcached.c#L1219
up
0
jooonic at googlemail dot com
2 years ago
Dont expect setmulti is faster then multiple SETs!
It doesn't use the setmulti lib function, it iterats over every key and send him alone.
I can't find any php implementation with setmulti support (needs support for memcached's binary protocol, remember php's "memcache"-extension only supports text-protocol).
Thats bad, not enought throughput to membase.
So i have to use redis instead, coz of its support for get/set multi.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites