Lines 267-276
Link Here
|
267 |
$host = $this->buckets[$hv % $this->bucketcount]; |
267 |
$host = $this->buckets[$hv % $this->bucketcount]; |
268 |
$sock = $this->sock_to_host($host); |
268 |
$sock = $this->sock_to_host($host); |
269 |
|
269 |
|
270 |
if($sock) |
270 |
if(is_resource($sock)) |
271 |
return $sock; |
271 |
return $sock; |
272 |
|
272 |
|
273 |
$hv += $this->_hashfunc($tries); |
273 |
$hv += $this->_hashfunc($tries); |
|
|
274 |
$tries++; |
274 |
} |
275 |
} |
275 |
|
276 |
|
276 |
return null; |
277 |
return null; |
Lines 298-306
Link Here
|
298 |
} |
299 |
} |
299 |
|
300 |
|
300 |
$len = strlen($val); |
301 |
$len = strlen($val); |
|
|
302 |
if (!is_int($exptime)) |
303 |
$exptime = 0; |
301 |
|
304 |
|
302 |
// send off the request |
305 |
// send off the request |
303 |
$cmd = "$cmdname $key $flags $exptime $len\r\n$val\r\n"; |
306 |
$cmd = "$cmdname $key $flags $exptime $len\r\n$val\r\n"; |
|
|
307 |
# echo "<br>Command is: $cmd<br>\n"; |
304 |
$cmd_len = strlen($cmd); |
308 |
$cmd_len = strlen($cmd); |
305 |
$offset = 0; |
309 |
$offset = 0; |
306 |
|
310 |
|
Lines 308-314
Link Here
|
308 |
$offset += socket_write($sock, substr($cmd, $offset, MC_BUFFER_SZ), MC_BUFFER_SZ); |
312 |
$offset += socket_write($sock, substr($cmd, $offset, MC_BUFFER_SZ), MC_BUFFER_SZ); |
309 |
|
313 |
|
310 |
// now read the server's response |
314 |
// now read the server's response |
311 |
if(socket_read($sock, 6, PHP_NORMAL_READ) == "STORED") |
315 |
$l_szResponse = socket_read($sock, 6, PHP_NORMAL_READ); |
|
|
316 |
if($l_szResponse == "STORED") |
312 |
{ |
317 |
{ |
313 |
if($this->debug) |
318 |
if($this->debug) |
314 |
print "MemCache: $cmdname $key = $raw_val\n"; |
319 |
print "MemCache: $cmdname $key = $raw_val\n"; |
Lines 318-324
Link Here
|
318 |
else |
323 |
else |
319 |
{ |
324 |
{ |
320 |
if($this->debug) |
325 |
if($this->debug) |
321 |
print "_set(): Did not receive STORED as the server response!\r\n"; |
326 |
print "_set(): Did not receive STORED as the server response!\r\n; received $l_szResponse instead"; |
322 |
} |
327 |
} |
323 |
|
328 |
|
324 |
return 0; |
329 |
return 0; |