Recently, at
http://www.eioba.com we were looking for a way to gain some performance. We started to use memory cache (included in eAccelerator).
So why not to keep PRADO templates and configs in memory? It's about 5-8 queries to database cache less, for every page!
Here's how to do it fast:
In your own Cache class add:
public function setRAM($key,$value,$expire)
{
eaccelerator_put($key,$value,$expire);
}
public function getRAM($key,$doUnserialize = true)
{
$value = eaccelerator_get($key);
if($value===NULL)
return false;
else
return $value;
}
and now in your default set and get mode:
protected function getValue($key)
{
if(strpos($key,"prado:")!==FALSE)
{
return $this->getRAM($key);
}
...
(instructions for standard case)
}
protected function setValue($key,$value,$expire)
{
if(strpos($key,"prado:")!==FALSE)
{
return $this->setRAM($key,$value,$expire);
}
...
(instructions for standard case)
}
Remember to overload function
generateUniqueKey to:
public function generateUniqueKey($key)
{
return $key;
}