PYTHON Memcached::getMulti

(0)
Python replacement for PHP's Memcached::getMulti [ edit ]



Do you know a Python replacement for PHP's Memcached::getMulti ? Write it!

PHP Memcached::getMulti

PHP original manual for Memcached::getMulti [ show | php.net ]

Memcached::getMulti

(PECL memcached >= 0.1.0)

Memcached::getMultiRetrieve multiple items

Description

public mixed Memcached::getMulti ( array $keys [, array &$cas_tokens ] )

Memcached::getMulti() is similar to Memcached::get, but instead of a single key item, it retrievess multiple items the keys of which are specified in the keys array. If cas_tokens variable is provided, it is filled with the CAS token values for the found items.

Note: Unlike Memcached::get it is not possible to specify a read-through cache callback for Memcached::getMulti(), because the memcache protocol does not provide information on which keys were not found in the multi-key request.

Parameters

keys

Array of keys to retrieve.

cas_tokens

The variable to store the CAS tokens for the found items.

Return Values

Returns the array of found items or FALSE on failure. Use Memcached::getResultCode if necessary.

Examples

Example #1 Memcached::getMulti() example

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

$items = array(
    
'key1' => 'value1',
    
'key2' => 'value2',
    
'key3' => 'value3'
);
$m->setMulti($items);
$result $m->getMulti(array('key1''key3''badkey'), $cas);
var_dump($result$cas);
?>

The above example will output something similar to:

array(2) {
  ["key1"]=>
  string(6) "value1"
  ["key3"]=>
  string(6) "value3"
}
array(2) {
  ["key1"]=>
  float(2360)
  ["key3"]=>
  float(2362)
}

See Also