3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 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
;
12 use Zend\Cache\Exception
;
13 use Zend\ServiceManager\AbstractPluginManager
;
16 * Plugin manager implementation for cache storage adapters
18 * Enforces that adapters retrieved are instances of
19 * StorageInterface. Additionally, it registers a number of default
22 class AdapterPluginManager
extends AbstractPluginManager
25 * Default set of adapters
29 protected $invokableClasses = array(
30 'apc' => 'Zend\Cache\Storage\Adapter\Apc',
31 'dba' => 'Zend\Cache\Storage\Adapter\Dba',
32 'filesystem' => 'Zend\Cache\Storage\Adapter\Filesystem',
33 'memcached' => 'Zend\Cache\Storage\Adapter\Memcached',
34 'memory' => 'Zend\Cache\Storage\Adapter\Memory',
35 'redis' => 'Zend\Cache\Storage\Adapter\Redis',
36 'session' => 'Zend\Cache\Storage\Adapter\Session',
37 'xcache' => 'Zend\Cache\Storage\Adapter\XCache',
38 'wincache' => 'Zend\Cache\Storage\Adapter\WinCache',
39 'zendserverdisk' => 'Zend\Cache\Storage\Adapter\ZendServerDisk',
40 'zendservershm' => 'Zend\Cache\Storage\Adapter\ZendServerShm',
44 * Do not share by default
48 protected $shareByDefault = false;
53 * Checks that the adapter loaded is an instance of StorageInterface.
55 * @param mixed $plugin
57 * @throws Exception\RuntimeException if invalid
59 public function validatePlugin($plugin)
61 if ($plugin instanceof StorageInterface
) {
66 throw new Exception\
RuntimeException(sprintf(
67 'Plugin of type %s is invalid; must implement %s\StorageInterface',
68 (is_object($plugin) ?
get_class($plugin) : gettype($plugin)),