Exemplo n.º 1
0
 /**
  * MPDOCacheManager constructor.
  *
  * @param array $option Unused
  * @throws \Exception
  */
 public function __construct(array $option)
 {
     parent::__construct($option);
     if (function_exists("apc_delete") === false) {
         throw new \Exception("APC is not installed");
     }
 }
 /**
  * MPDOCacheManager constructor.
  *
  * @param array $option Must contains an item called 'db' containing an {@link \PDO} object and an item called
  *     'table' containing the table name of the database to use to store the cache item.
  * @throws \Exception
  */
 public function __construct(array $option)
 {
     parent::__construct($option);
     if (isset($option['db']) === false || isset($option['table']) === false) {
         throw new \Exception('Mandatory options are not set!');
     }
     $this->setPdoConnection($option['db']);
     $this->setTableName($option['table']);
 }
Exemplo n.º 3
0
 /**
  * MPDOCacheManager constructor.
  *
  * @param array $option Must contains an item called 'path' containing the path to use to store the cache item.
  * @throws \Exception
  */
 public function __construct(array $option)
 {
     parent::__construct($option);
     if (isset($option['path']) === false) {
         throw new \Exception('Mandatory options are not set!');
     }
     $this->setPath($option['path']);
     if (file_exists($this->path) === false) {
         throw new \Exception(sprintf('Path \'%s\' does not exist!', $this->path));
     }
     if (substr($this->path, strlen($this->path) - 1) !== DIRECTORY_SEPARATOR) {
         $this->path = $this->path . DIRECTORY_SEPARATOR;
     }
     if (file_exists($this->getBasePath()) === false) {
         mkdir($this->getBasePath());
     }
 }