Checking Memcached Usage on WordPress Site?

Photo of author

By arkmason.com

[ad_1]

<?php

try

{
    $memcached = new Memcached();
    $memcached->addServer("127.0.0.1", 11211);
    $response = $memcached->get("sample_key");
 
    if($response==true)
    {
      echo $response;
    }

    else

    {
    echo "Cache is empty";
    $memcached->set("sample_key", "Sample data from cache") ;
    }
}
catch (exception $e)
{
echo $e->getMessage();
}
?>

[ad_2]

Source link