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

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -