/** * * * servers - An array of servers, with each server represented by its own array (array(host, port, [weight])). If * not passed the default is array('127.0.0.1', 11211). * * * extension - Which php extension to use, either 'memcache' or 'memcache'. Defaults to memcache with memcache * as a fallback. * * * Options can be passed to the "memcache" driver by adding them to the options array. The memcache extension * defined options using constants, ie Memcached::OPT_*. By passing in the * portion ('compression' for * Memcached::OPT_COMPRESSION) and its respective option. Please see the php manual for the specific options * (http://us2.php.net/manual/en/memcache.constants.php) * * @param array $options */ public function __construct(array $options = array()) { if (!isset($options['servers'])) { $options['servers'] = array('127.0.0.1', 11211); } if (is_scalar($options['servers'][0])) { $servers = array($options['servers']); } else { $servers = $options['servers']; } if (!isset($options['extension'])) { $options['extension'] = 'any'; } $extension = strtolower($options['extension']); if (class_exists('Memcached', false) && $extension != 'memcache') { $this->memcache = new ehough_stash_driver_sub_Memcached(); } elseif (class_exists('Memcache', false) && $extension != 'memcached') { $this->memcache = new ehough_stash_driver_sub_Memcache(); } else { throw new ehough_stash_exception_RuntimeException('No memcache extension available.'); } $this->memcache->initialize($servers, $options); }