I was having trouble making method calls with the result callbacks in getDelayed, so I emailed the developer.
If you want to use a non-static method as a callback, use the following format: array($obj, 'method'); for example:
<?php
class foo {
private $M = false;
public function __construct() {
$this->M = new Memcached();
$this->M->addServer('localhost', 11211);
$this->M->set('a', 'test');
}
public function test() {
$this->M->getDelayed(array('a'), false, array($this, 'fun'));
}
public function fun() {
echo "Great Success!";
}
}
$f = new foo();
$f->test();
?>
or, alternatively:
<?php
class foo {
public $M = false;
public function __construct() {
$this->M = new Memcached();
$this->M->addServer('localhost', 11211);
$this->M->set('a', 'test');
}
public function fun() {
echo "Great Success!";
}
}
$f = new foo();
$f->M->getDelayed(array('a'), false, array($f, 'fun'));
?>
Works great, thanks Andrei :)