ActiveRecord\Memcache::__construct PHP Method

__construct() public method

Takes an $options array w/ the following parameters:
  • host: host for the memcache server
  • port: port for the memcache server
public __construct ( array $options )
$options array
    public function __construct($options)
    {
        $this->memcache = new \Memcache();
        $options['port'] = isset($options['port']) ? $options['port'] : self::DEFAULT_PORT;
        if (!@$this->memcache->connect($options['host'], $options['port'])) {
            if ($error = error_get_last()) {
                $message = $error['message'];
            } else {
                $message = sprintf('Could not connect to %s:%s', $options['host'], $options['port']);
            }
            throw new CacheException($message);
        }
    }