. */ namespace Doctrine\ORM\Cache; /** * Cache regions configuration * * @since 2.5 * @author Fabio B. Silva */ class RegionsConfiguration { /** * @var array */ private $lifetimes = array(); /** * @var array */ private $lockLifetimes = array(); /** * @var integer */ private $defaultLifetime; /** * @var integer */ private $defaultLockLifetime; /** * @param integer $defaultLifetime * @param integer $defaultLockLifetime */ public function __construct($defaultLifetime = 3600, $defaultLockLifetime = 60) { $this->defaultLifetime = (integer) $defaultLifetime; $this->defaultLockLifetime = (integer) $defaultLockLifetime; } /** * @return integer */ public function getDefaultLifetime() { return $this->defaultLifetime; } /** * @param integer $defaultLifetime */ public function setDefaultLifetime($defaultLifetime) { $this->defaultLifetime = (integer) $defaultLifetime; } /** * @return integer */ public function getDefaultLockLifetime() { return $this->defaultLockLifetime; } /** * @param integer $defaultLockLifetime */ public function setDefaultLockLifetime($defaultLockLifetime) { $this->defaultLockLifetime = (integer) $defaultLockLifetime; } /** * @param string $regionName * * @return integer */ public function getLifetime($regionName) { return isset($this->lifetimes[$regionName]) ? $this->lifetimes[$regionName] : $this->defaultLifetime; } /** * @param string $name * @param integer $lifetime */ public function setLifetime($name, $lifetime) { $this->lifetimes[$name] = (integer) $lifetime; } /** * @param string $regionName * * @return integer */ public function getLockLifetime($regionName) { return isset($this->lockLifetimes[$regionName]) ? $this->lockLifetimes[$regionName] : $this->defaultLockLifetime; } /** * @param string $name * @param integer $lifetime */ public function setLockLifetime($name, $lifetime) { $this->lockLifetimes[$name] = (integer) $lifetime; } }