Take this code for example
$memcache= new Memcache();
$memcache->connect('127.0.0.1', 11211);
$rows2= $memcache->get('therows1');
if($rows2 == ''){
$myfriends = findfriend2();
$memcache->set('therows1', $myfriends, 0, 30);
}else{
echo '<pre>';
print_r($rows2);
echo '</pre>';
}
The connection; $memcache->connect('127.0.0.1', 11211);
Does this need to be called several times on a page or just 1 time per page load?
And then this way
$memcache_obj = memcache_connect('memcache_host', 11211);
$var = memcache_get($memcache_obj, 'some_key');
It appears $memcache_obj is called on every action you do on that page, does that mean it would be bad performance to for instance call 5 seperate memcached items on a page?