How can i do the followin tasks
public function addToCache($id,$items)
{
// in zend cache
}
public function getFromCache($id)
{
// in zend cache
}
The first method should take an id and items which should be cached.
The second method should just take an id of an cached object, and should return the content of the cache of that item id.
i want to be able to do something like that;
public function getItems()
{
if(!$this->cache->getFromCache('items'))
{
$this->addToCache('items',$this->feeds->items());
return $this->cache->getFromCache('items');
}
}
How can i do the both methods in zend cache ?
Everything to get started is in the Zend docs. You do have to dig in a little and get comfortable, it’s not a “quick how do I do this” type of area.
But, the general cache-check looks like this: