ATM i'm manually generating a cache key based on the method name and parameters, then follow to the normal cache pattern. This is all done in the Controller and i'm calling a model class that 'extends Zend_Db_Table_Abstract'.
public function indexAction()
{
$cache = Zend_Registry::get('cache');
$individualleaguekey = sprintf("getIndividualLeague_%d_%s",$leagueid,$division->code);
if(!$leaguetable = $cache->load($individualleaguekey))
{
$table = new Model_DbTable_Raceresult();
$leaguetable = $table->getIndividualLeague($leagueid,$division,$races);
$cache->save($leaguetable, $individualleaguekey);
}
$this->view->leaguetable = $leaguetable;
....
I want to avoid the duplication of parameters to the cache creation method and also to the model method, so i'm thinking of moving the caching logic away from my controller class and into model class packaged in './model/DbTable', but this seems incorrect since the DB model should only handle SQL operations. Any suggestions on how i can implement a clean patterned solution?