Subversion Repositories Applications.framework

Compare Revisions

Ignore whitespace Rev 269 → Rev 268

/trunk/framework/CacheSqlite.php
File deleted
\ No newline at end of file
/trunk/framework/CacheFichier.php
67,8 → 67,7
*/
protected $metadonnees = array();
 
private $Cache = null;
 
/**
* Constructor
*
76,8 → 75,7
* @throws Zend_Cache_Exception
* @return void
*/
public function __construct(array $options = array(), Cache $cache) {
$this->Cache = $cache;
public function __construct(array $options = array()) {
$this->setOptions($options);
 
if (isset($this->options['prefixe_fichier'])) {
197,7 → 195,7
$metadonnees = array(
'hash' => $cle_secu,
'mtime' => time(),
'expiration' => $this->Cache->getTimestampExpiration($duree_vie_specifique),
'expiration' => $this->getTimestampExpiration($duree_vie_specifique),
'tags' => $tags
);
 
699,6 → 697,19
}
 
/**
* Compute & return the expire time
*
* @return int expire time (unix timestamp)
*/
protected function getTimestampExpiration($duree_de_vie) {
if ($duree_de_vie === false) {
$duree_de_vie = 3600;
}
$timestamp = ($duree_de_vie === null) ? 9999999999 : (time() + $duree_de_vie);
return $timestamp;
}
 
/**
* Make a control key with the string containing datas
*
* @param string $data Data
/trunk/framework/Cache.php
84,12 → 84,12
protected $stockage = null;
public function __construct($options, $options_stockage = array()) {
public function __construct($options, $options_stockage) {
$this->setOptions($options);
if ($this->options['stockage_mode'] == self::STOCKAGE_MODE_FICHIER) {
$this->stockage = new CacheFichier($options_stockage, $this);
$this->stockage = new CacheFichier($options_stockage);
} else if ($this->options['stockage_mode'] == self::STOCKAGE_MODE_SQLITE) {
$this->stockage = new CacheSqlite($options_stockage, $this);
$this->stockage = new CacheSqlite($options_stockage);
}
$this->stockage->setEmplacement($this->options['stockage_chemin']);
}
455,21 → 455,5
reset($tags);
}
/**
* Calcule et retourne le timestamp d'expiration
*
* @return int timestamp d'expiration (unix timestamp)
*/
public function getTimestampExpiration($duree_de_vie) {
if ($duree_de_vie === false) {
if (isset($this->options['duree_de_vie']) && is_int($this->options['duree_de_vie'])) {
$duree_de_vie = (int) $this->options['duree_de_vie'];
} else {
$duree_de_vie = 3600;
}
}
$timestamp = ($duree_de_vie === null) ? 9999999999 : (time() + $duree_de_vie);
return $timestamp;
}
}