note 86351 modified in function.memcache-get by danbrown

From: Date: Sat, 19 Jun 2010 14:34:19 +0000
Subject: note 86351 modified in function.memcache-get by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-170313@lists.php.net to get a copy of this message
Be aware that when using the multi-key version, Memcache::get returns bool false if no servers are configured for the pool (and possibly if other errors occur as well while attempting to fetch). Also, Memcache class throws annoying warnings on every get/set/delete-type calls if you have no servers added to the pool. The following snippet var_dump's bool false, not an empty array like you might expect. <?php $cache = new Memcache; // no $cache->addServer calls (for example, due to temporarily disabling use of cache) // use @ symbol to ignore warning var_dump( @$cache->get(array('one', 'two')) ); ?> --was-- Be aware that when using the multi-key version, Memcache::get returns bool false if no servers are configured for the pool (and possibly if other errors occur as well while attempting to fetch). Also, Memcache class throws annoying warnings on every get/set/delete-type calls if you have no servers added to the pool. The following snippet var_dump's bool false, not an empty array like you might expect. <?php $cache = new Memcache; // no $cache->addServer calls (for example, due to temporarily disabling use of cache) // use @ symbol to ignore warning var_dump( @$cache->get(array('one', 'two')) ); ?> http://php.net/manual/en/function.memcache-get.php

« previous php.notes (#170313) next »