CakeFest 2024: The Official CakePHP Conference

Memcached::fetch

(PECL memcached >= 0.1.0)

Memcached::fetch次の結果を取得する

説明

public Memcached::fetch(): array|false

Memcached::fetch() は、直近のリクエストから次の結果を取得します。

パラメータ

この関数にはパラメータはありません。

戻り値

次の結果、あるいは false を返します。 結果セットをすべて処理し終えた場合、 Memcached::getResultCode()Memcached::RES_END を返します。

例1 Memcached::fetch() の例

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

$m->set('int', 99);
$m->set('string', 'a simple string');
$m->set('array', array(11, 12));

$m->getDelayed(array('int', 'array'), true);
while (
$result = $m->fetch()) {
var_dump($result);
}
?>

上の例の出力は、 たとえば以下のようになります。

array(3) {
  ["key"]=>
  string(3) "int"
  "value"]=>
  int(99)
  ["cas"]=>
  float(2363)
}
array(3) {
  ["key"]=>
  string(5) "array"
  ["value"]=>
  array(2) {
    [0]=>
    int(11)
    [1]=>
    int(12)
  }
  ["cas"]=>
  float(2365)
}

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top