|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-11-17 10:34 UTC] dan at moo dot com
Description:
------------
Occasionally the set() method fails, but no reason is given as to why. Memcached returns the error (e.g. SERVER_ERROR out of memory) but this wrapper throws that error away instead of allowing the caller to find out why the set() failed (short of stracing, which can be a little to IO intensive on a large site with a seemingly randomly reoccurring set() problem)
Reproduce code:
---------------
if (!$memcache->set('key', 'value', MEMCACHE_COMPRESSED)) {
print 'I failed to do your bidding but cannot for the life of me tell you why';
}
// You get the idea...
Expected result:
----------------
A helpful message that lets me know why I couldn't set a key/value pair
Actual result:
--------------
Nothing but a false.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 08:00:01 2025 UTC |
The error message is printed as an E_NOTICE if you don't have an failure callback set, if a failure callback is set the message is sent as the 4:th param to that callback. If you don't see this message it might be because you have the error reporting level set to low, you can fix this by calling error_reporting(E_ALL) or modifying the matching php.ini setting. Or using Memcache::addServer with a failure callback like function my_failure_callback($host, $tcp_port, $udp_port, $error, $errnum) { print $error; } $memcache = new Memcache; $memcache->addServer('localhost', 11211, true, 1, 1, 15, true, 'my_failure_callback');