litememcache icon indicating copy to clipboard operation
litememcache copied to clipboard

Оптимизация метода get

Open ParkFramework opened this issue 10 years ago • 1 comments

public function get($key)
{
    fwrite($this->_socket, "get $key\r\n");

    if(sscanf(fgets($this->_socket), 'VALUE %s %d %d', $key, $flag, $len))
    {
        $value = fread($this->_socket, $len);

        fread($this->_socket, 7);

        return $value;
    }

    return false;
}

ParkFramework avatar Apr 16 '14 23:04 ParkFramework

Current implementation of method get supports additionally extended requests. The code above does not.

ptrofimov avatar Apr 17 '14 08:04 ptrofimov