/**
* Method to load a value from cache.
*
* @param string $id
* @param string $time
* @return mixed
*/
public function load($id, $time)
{
$value = false;
// Retrieve the value.
$this->sqlite->select()->where()->equalTo('id', ':id');
$this->sqlite->adapter()->prepare($this->sqlite->render(true))->bindParams(array('id' => sha1($id)))->execute();
$rows = $this->sqlite->adapter()->fetchResult();
// If the value is found, check expiration and return.
if (count($rows) > 0) {
$data = $rows[0]['value'];
$dbTime = $rows[0]['time'];
if (time() - $dbTime <= $time) {
$value = unserialize($data);
}
}
return $value;
}