This commit is contained in:
parent
ddb45098c0
commit
dc73de10b3
@ -39,6 +39,7 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite
|
||||
'lifeTime' => 3600,
|
||||
'statsSlamDefense' => 0.75,
|
||||
'saveSlamDefense' => 0.80,
|
||||
'cleanPropability' => 0.98,
|
||||
'statsFile' => '../data/stats.cache',
|
||||
);
|
||||
/**
|
||||
@ -53,6 +54,10 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite
|
||||
* @var array $data current cache data array
|
||||
*/
|
||||
protected $_data;
|
||||
/**
|
||||
* @var boolean $success the success of last operation
|
||||
*/
|
||||
protected $_success = false;
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
@ -194,6 +199,13 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite
|
||||
{
|
||||
return new ArrayIterator($this->_queries);
|
||||
}
|
||||
/**
|
||||
* @return boolean whether or not the last cache operation was successful
|
||||
*/
|
||||
public function isSuccessful()
|
||||
{
|
||||
return $this->_success;
|
||||
}
|
||||
/**
|
||||
* save
|
||||
*
|
||||
@ -265,6 +277,8 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite
|
||||
|
||||
$data = $this->_driver->fetch(md5($query));
|
||||
|
||||
$this->success = ($data) ? true : false;
|
||||
|
||||
$this->_data = $data;
|
||||
|
||||
return true;
|
||||
@ -319,6 +333,8 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite
|
||||
|
||||
$data = $this->_driver->fetch(md5(serialize(array($query, $event->getParams()))));
|
||||
|
||||
$this->success = ($data) ? true : false;
|
||||
|
||||
$this->_data = $data;
|
||||
|
||||
return true;
|
||||
@ -326,6 +342,15 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* onExecute
|
||||
* listens the onExecute event of Doctrine_Db_Statement
|
||||
*
|
||||
* adds the issued query to internal query stack
|
||||
* and checks if cached element exists
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
/**
|
||||
* destructor
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user