2011-09-28 6 views
2

Predis에서 BLPOP의 올바른 구문은 무엇입니까?

$r = new Predis\Client($single_server, $options); 
$retval = $r->blpop('queue:query'); 

하지만이 오류가 발생합니다.

ERR wrong number of arguments for 'blpop' command

$r = new Predis\Client($single_server, $options); 
$retval = $r->blpop('queue:query',0); 

오류가 발생합니다.

Error while reading line from the server

에서 지우기 redis-cli

redis 127.0.0.1:6379> BLPOP queue:query 
(error) ERR wrong number of arguments for 'blpop' command 
redis 127.0.0.1:6379> BLPOP queue:query 0 
1) "queue:query" 
2) "hello world" 
+0

'$ r-> blpop (array ('queue : query', 0))'시도해 봤어? – Niloct

답변

1

에서 그것을 이렇게하면 벌레처럼 보인다. 나는이 페이지에 액세스 할 때 차단

<? 
include_once "Predis.php"; 

$r = new Predis_Client(); 
$retval = $r->blpop('queue:query',0); 
var_dump($retval); 
?> 

다음 latest 버전은이 문제를 가지고 있지 않으며, 또한 분명히 네임 스페이스를 떨어졌다. 그리고, 나는, LPUSH queue:query 0을 발급 다시 페이지로 가서이있어 :이 PHP 확장으로 컴파일되어 있기 때문에

array(2) { [0]=> string(11) "queue:query" [1]=> string(1) "0" } 

그럼에도 불구하고, 나는 phpredis의 사용을 추천 할 것을, 그것은,이 라이브러리보다 빠릅니다. 서버에 권한이있는 경우 좋은 선택입니다.

관련 문제