3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Cache\Storage\Adapter
;
12 use Zend\Cache\Exception
;
15 * These are options specific to the APC adapter
17 class DbaOptions
extends AdapterOptions
24 protected $namespaceSeparator = ':';
27 * Pathname to the database file
31 protected $pathname = '';
34 * The mode to open the database
38 protected $mode = 'c';
41 * The name of the handler which shall be used for accessing the database.
45 protected $handler = 'flatfile';
48 * Set namespace separator
50 * @param string $namespaceSeparator
51 * @return DbaOptions Provides a fluent interface
53 public function setNamespaceSeparator($namespaceSeparator)
55 $namespaceSeparator = (string) $namespaceSeparator;
56 $this->triggerOptionEvent('namespace_separator', $namespaceSeparator);
57 $this->namespaceSeparator
= $namespaceSeparator;
62 * Get namespace separator
66 public function getNamespaceSeparator()
68 return $this->namespaceSeparator
;
72 * Set pathname to database file
74 * @param string $pathname
75 * @return DbaOptions Provides a fluent interface
77 public function setPathname($pathname)
79 $this->pathname
= (string) $pathname;
80 $this->triggerOptionEvent('pathname', $pathname);
85 * Get pathname to database file
89 public function getPathname()
91 return $this->pathname
;
98 * @return DbaOptions Provides a fluent interface
100 public function setMode($mode)
102 $this->mode
= (string) $mode;
103 $this->triggerOptionEvent('mode', $mode);
107 public function getMode()
115 * @param string $handler
116 * @return DbaOptions Provides a fluent interface
118 public function setHandler($handler)
120 $handler = (string) $handler;
122 if (! function_exists('dba_handlers') ||
! in_array($handler, dba_handlers())) {
123 throw new Exception\
ExtensionNotLoadedException("DBA-Handler '{$handler}' not supported");
126 if ($handler === 'inifile') {
127 throw new Exception\
ExtensionNotLoadedException(
128 "DBA-Handler 'inifile' does not reliably support write operations"
132 $this->triggerOptionEvent('handler', $handler);
133 $this->handler
= $handler;
137 public function getHandler()
139 return $this->handler
;