*/
function memcached ($args)
{
- $this->set_servers($args['servers']);
- $this->_debug = $args['debug'];
+ $this->set_servers(@$args['servers']);
+ $this->_debug = @$args['debug'];
$this->stats = array();
- $this->_compress_threshold = $args['compress_threshold'];
- $this->_persistant = isset($args['persistant']) ? $args['persistant'] : false;
+ $this->_compress_threshold = @$args['compress_threshold'];
+ $this->_persistant = array_key_exists('persistant', $args) ? (@$args['persistant']) : false;
$this->_compress_enable = true;
$this->_have_zlib = function_exists("gzcompress");
$key = is_array($key) ? $key[1] : $key;
- $this->stats['delete']++;
+ @$this->stats['delete']++;
$cmd = "delete $key $time\r\n";
if(!fwrite($sock, $cmd, strlen($cmd)))
{
if (!is_resource($sock))
return false;
- $this->stats['get']++;
+ @$this->stats['get']++;
$cmd = "get $key\r\n";
if (!fwrite($sock, $cmd, strlen($cmd)))
if ($this->_debug)
foreach ($val as $k => $v)
- $this->_debugprint(sprintf("MemCache: sock %s got %s => %s\r\n", $sock, $k, $v));
+ $this->_debugprint(@sprintf("MemCache: sock %s got %s => %s\r\n", serialize($sock), $k, $v));
- return $val[$key];
+ return @$val[$key];
}
// }}}
function _dead_sock ($sock)
{
$host = array_search($sock, $this->_cache_sock);
- list ($ip, $port) = explode(":", $host);
+ @list ($ip, $port) = explode(":", $host);
$this->_host_dead[$ip] = time() + 30 + intval(rand(0, 10));
$this->_host_dead[$host] = $this->_host_dead[$ip];
unset($this->_cache_sock[$host]);
*/
function _hashfunc ($key)
{
- $hash = 0;
- for ($i=0; $i<strlen($key); $i++)
- {
- $hash = $hash*33 + ord($key[$i]);
- }
-
- return $hash;
+ return crc32($key);
}
// }}}
break;
$offset += $n;
$bneed -= $n;
- $ret[$rkey] .= $data;
+ @$ret[$rkey] .= $data;
}
if ($offset != $len+2)
if (!is_resource($sock))
return false;
- $this->stats[$cmd]++;
+ @$this->stats[$cmd]++;
$flags = 0;