How to use memcache cache

<?php    

   $memobj= new memcache();

    $memobj->connect('127.0.0.1','11211');      
    $memobj->set("name",$arr,false,1); //arr remains the same as foreach
    $aa=$memobj->get ('name');
    if(!empty($aa)){
        echo "read data from mem";
    }else{
        echo "check data";
    }

            ob_start()//Open the cache

?>

Remember that ob_start must enable caching

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325847794&siteId=291194637