Created
April 24, 2012 23:55
-
-
Save SocalNick/2484730 to your computer and use it in GitHub Desktop.
Bug in Zend\Cache or Zend\EventManager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace { | |
require_once 'ZendFramework/library/Zend/Loader/StandardAutoloader.php'; | |
$autoloader = new \Zend\Loader\StandardAutoloader; | |
spl_autoload_register(array($autoloader, 'autoload')); | |
$di = new Zend\Di\Di; | |
$di->configure( | |
new Zend\Di\Configuration( | |
array( | |
'definition' => array( | |
'class' => array( | |
'Zend\Cache\Storage\Adapter\Memcached' => array( | |
'instantiator' => array( | |
'Zend\Cache\StorageFactory', | |
'factory', | |
), | |
), | |
'Zend\Cache\StorageFactory' => array( | |
'methods' => array( | |
'factory' => array( | |
'required' => true, | |
'cfg' => array( | |
'required' => true, | |
), | |
), | |
), | |
), | |
), | |
), | |
'instance' => array( | |
'preferences' => array( | |
// Use EventManager for EventCollection | |
'Zend\EventManager\EventCollection' => 'Zend\EventManager\EventManager', | |
// Use SharedEventManager for SharedEventCollection | |
'Zend\EventManager\SharedEventCollection' => 'Zend\EventManager\SharedEventManager', | |
), | |
'Zend\EventManager\EventManager' => array( | |
'shared' => false, // new instance per class needing an instance | |
), | |
'Zend\Cache\Storage\Adapter\Memcached' => array( | |
'parameters' => array( | |
'cfg' => array( | |
'adapter' => array( | |
'name' => 'Zend\Cache\Storage\Adapter\Memcached', | |
'options' => array( | |
'namespace' => 'phantom-services', | |
'ttl' => 3600, | |
), | |
), | |
'plugins' => array( | |
'serializer', | |
), | |
), | |
), | |
), | |
), | |
) | |
) | |
); | |
$memcached = $di->get('Zend\Cache\Storage\Adapter\Memcached'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment