: "Read this code today,
1 Public functionGET_COMPANY_BY_ID ($company _id,$CACHE _clear=FALSE)2 {3 $cachekey= ' Global:x_table|id: '.$company _id;4 if($CACHE _clear) {5 $this->cache->del ($cachekey);6}Else {7 $data=$this->cache->get ($cachekey,Cache_expire_week);8 if(FALSE!==$data) {9 return $data;Ten } One } A - $o=$this->db->fetch_single (' SELECT * from x_table WHERE id= '.$company _id.‘" LIMIT 1 '); - if($o) { the $this->cache->set ($cachekey,$o,Cache_expire_week); - return $o; - } - + return FALSE; -}
There is comprehension. Is our redis just a cache of accelerated queries prior to MySQL? Then its relative to the advantages of memcached is not reflected, then why not directly with memcached? "
: "Start is MySQL, then we introduced memcached, think memcached not support cluster, also not good use, so we introduced the Redis." ”
: "Then why don't we all use Redis?" ”
: "That's going to change the whole code."
PHP_REDIS::CONNETCT ()