note 89514 added to memcached.callbacks.result

From: Date: Thu, 12 Mar 2009 01:54:11 +0000
Subject: note 89514 added to memcached.callbacks.result
Groups: php.notes 
Request: Send a blank email to php-notes+get-151751@lists.php.net to get a copy of this message
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: 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: 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 :) ---- Server IP: 209.41.74.194 Probable Submitter: 98.193.147.56 ---- Manual Page -- http://www.php.net/manual/en/memcached.callbacks.result.php Edit -- https://master.php.net/note/edit/89514 Del: integrated -- https://master.php.net/note/delete/89514/integrated Del: useless -- https://master.php.net/note/delete/89514/useless Del: bad code -- https://master.php.net/note/delete/89514/bad+code Del: spam -- https://master.php.net/note/delete/89514/spam Del: non-english -- https://master.php.net/note/delete/89514/non-english Del: in docs -- https://master.php.net/note/delete/89514/in+docs Del: other reasons-- https://master.php.net/note/delete/89514 Reject -- https://master.php.net/note/reject/89514 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#151751) next »