Home  >  Article  >  Backend Development  >  php里对redis的非空集合执行spop命令返回false

php里对redis的非空集合执行spop命令返回false

WBOY
WBOYOriginal
2016-06-06 20:07:481133browse

对同一个集合,执行$redis->scard( 'set:name' );结果是6W多。

但是对这个集合执行$redis->spop( 'set:name' );就返回false了。

集合名应该没有写错,因为代码运行了一段时间是正常的,突然之间就这样了。

请问有人遇到过相似的问题吗,如何解决?

<code>echo $redis->SCARD( 'news:id:needCrawlComment' ) . PHP_EOL;
echo $redis->SRANDMEMBER( 'news:id:needCrawlComment' ) . PHP_EOL;
var_dump( $redis->SPOP( 'news:id:needCrawlComment' ) ) . PHP_EOL;
exit;</code>

输出结果

<code>60028
1166728333
bool(false)</code>

回复内容:

对同一个集合,执行$redis->scard( 'set:name' );结果是6W多。

但是对这个集合执行$redis->spop( 'set:name' );就返回false了。

集合名应该没有写错,因为代码运行了一段时间是正常的,突然之间就这样了。

请问有人遇到过相似的问题吗,如何解决?

<code>echo $redis->SCARD( 'news:id:needCrawlComment' ) . PHP_EOL;
echo $redis->SRANDMEMBER( 'news:id:needCrawlComment' ) . PHP_EOL;
var_dump( $redis->SPOP( 'news:id:needCrawlComment' ) ) . PHP_EOL;
exit;</code>

输出结果

<code>60028
1166728333
bool(false)</code>

问题已解决,原因是内存超过1/2了,用sysctl vm.overcommit_memory=1解决了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn