/** * @throws Behance\NBD\Cache\Exceptions\SystemRequirementException when memcache extension is not loaded * * @param Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher * @param Memcache $instance */ public function __construct(EventDispatcherInterface $event_dispatcher = null, \Memcache $instance = null) { $this->_connection = $instance ?: new \Memcache(); // Really unfortunate to have to do this $this->_memcache_get_requires_filler = (new \ReflectionMethod('Memcache', 'get'))->getNumberOfParameters() > 1; parent::__construct($event_dispatcher); }
/** * @param Symfony\Component\EventDispatcher\EventDispatcherInterface * @param Memcached $instance */ public function __construct(EventDispatcherInterface $event_dispatcher = null, \Memcached $instance = null) { $this->_connection = $instance ?: new \Memcached(); // IMPORTANT: Unfortunately, there is a breaking change in the 3.0 version of Memcached driver...handle it $this->_memcached_version_3_0 = (new \ReflectionMethod('Memcached', 'getMulti'))->getNumberOfParameters() == 2; parent::__construct($event_dispatcher); }
/** * @param Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher * @param Redis $instance */ public function __construct(EventDispatcherInterface $event_dispatcher = null, \Redis $instance = null) { $this->_connection = $instance ?: new \Redis(); parent::__construct($event_dispatcher); }