return false;
}
- /**
- * @param $key
- * @param $timeout int
- * @return bool
- */
public function lock( $key, $timeout = 0 ) {
/* stub */
return true;
}
- /**
- * @param $key
- * @return bool
- */
public function unlock( $key ) {
/* stub */
return true;
$this->stats['get_multi'] = 1;
}
$sock_keys = array();
- $socks = array();
+
foreach ( $keys as $key ) {
$sock = $this->get_sock( $key );
if ( !is_resource( $sock ) ) {
$sock_keys[$sock][] = $key;
}
- $gather = array();
// Send out the requests
foreach ( $socks as $sock ) {
$cmd = 'get';
return array();
}
- $ret = array();
while ( true ) {
$res = fgets( $sock );
$ret[] = $res;
$this->_dead_host( $host );
}
- /**
- * @param $host
- */
function _dead_host( $host ) {
$parts = explode( ':', $host );
$ip = $parts[0];
}
$hv = is_array( $key ) ? intval( $key[0] ) : $this->_hashfunc( $key );
+
if ( $this->_buckets === null ) {
- $bu = array();
foreach ( $this->_servers as $v ) {
if ( is_array( $v ) ) {
for( $i = 0; $i < $v[1]; $i++ ) {
$this->stats[$cmd] = 1;
}
if ( !$this->_safe_fwrite( $sock, "$cmd $key $amt\r\n" ) ) {
- $this->_dead_sock( $sock );
- return null;
+ return $this->_dead_sock( $sock );
}
$line = fgets( $sock );
}
}
if ( !$this->_safe_fwrite( $sock, "$cmd $key $flags $exp $len\r\n$val\r\n" ) ) {
- $this->_dead_sock( $sock );
- return false;
+ return $this->_dead_sock( $sock );
}
$line = trim( fgets( $sock ) );
}
if ( !$this->_connect_sock( $sock, $host ) ) {
- $this->_dead_host( $host );
- return null;
+ return $this->_dead_host( $host );
}
// Do not buffer writes
return $this->_cache_sock[$host];
}
- /**
- * @param $str string
- */
function _debugprint( $str ) {
print( $str );
}
/**
* Original behaviour
- * @param $f
- * @param $buf
- * @param $len bool
* @return int
*/
function _safe_fwrite( $f, $buf, $len = false ) {
/**
* Flush the read buffer of a stream
- * @param $f Resource
*/
function _flush_read_buffer( $f ) {
if ( !is_resource( $f ) ) {