php - Memcache interesting bug - a:0:{} -


the code simple

$mem = $this->memcache->get("memche_".$_session['userid']."_page_".$page);  if(empty($mem)){ // make query , save data memcache } else { // memcache } 

but right there no data cache not empty if print_r($mem);

a:0:{} 

and pass if statement if(empty())

that not bug, have empty array stored in memcache. array empty, not variable referencing array.

var_dump(unserialize('a:0:{}')); array(0) { } 

you should checking if $mem false ($mem===false), not if empty. memcache returns false if cache key doesn't exist.


Comments

Popular posts from this blog

Glib GIOChannel -

jsp - java.sql.SQLException: [Microsoft][ODBC Microsoft Access > Driver] Too few parameters. Expected 1 -

delphi - When I encode/decode SMS PDU (GSM 7 Bit) user data, do I need prepend the UDH first? -