PHP_REDIS::CONNETCT ()

Source: Internet
Author: User

: "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 ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.