Across our application, we use subclasses of Zend_Db_Row
to represent objects in our application. these objects are being returned by various fetch functions.
<?php
require_once 'Zend/Db.php';
class Model_Users extends Zend_Db_Table_Abstract
{
protected $_name = 'users';
protected $_primary = 'userId';
protected $_rowClass = 'Model_User';
/**
* fetch user by email
*
* @param string $email
*/
public function fetchWithEmail($email)
{
$select = $this->select();
$select->where('email = ?', $email);
return $this->fetchRow($select);
}
}
The issue is that we call the fetch functions multiple times (with the same values) from different functions, models, controllers and such. so for example, $modelUsers->fetchWithEmail('user@domain.com')
appears 10 times in a single php script execution.
We are planning on using memcached for caching these objects, however, it would still call the cache server 10 times (instead of calling the database 10 times). using memcache will be faster, but we want to call the cache server only once (instead of 10 times)
Any framework / module of zend framework that can help us archive some kind of local cache? That if our script will call $modelUsers->fetchWithEmail('user@domain.com')
, it would enter the script memory until the script execution was completed (or either an update or delete function changed the value of that row in the database)