You are here

public function PHPExcel_CachedObjectStorage_Memcache::__construct in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/Memcache.php \PHPExcel_CachedObjectStorage_Memcache::__construct()

* Initialise this new cell collection * *

Parameters

PHPExcel_Worksheet $parent The worksheet for this cell collection: * @param array of mixed $arguments Additional initialisation arguments

Overrides PHPExcel_CachedObjectStorage_CacheBase::__construct

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/Memcache.php, line 255

Class

PHPExcel_CachedObjectStorage_Memcache
PHPExcel_CachedObjectStorage_Memcache

Code

public function __construct(PHPExcel_Worksheet $parent, $arguments) {
  $memcacheServer = isset($arguments['memcacheServer']) ? $arguments['memcacheServer'] : 'localhost';
  $memcachePort = isset($arguments['memcachePort']) ? $arguments['memcachePort'] : 11211;
  $cacheTime = isset($arguments['cacheTime']) ? $arguments['cacheTime'] : 600;
  if (is_null($this->_cachePrefix)) {
    $baseUnique = $this
      ->_getUniqueID();
    $this->_cachePrefix = substr(md5($baseUnique), 0, 8) . '.';

    //	Set a new Memcache object and connect to the Memcache server
    $this->_memcache = new Memcache();
    if (!$this->_memcache
      ->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array(
      $this,
      'failureCallback',
    ))) {
      throw new PHPExcel_Exception('Could not connect to MemCache server at ' . $memcacheServer . ':' . $memcachePort);
    }
    $this->_cacheTime = $cacheTime;
    parent::__construct($parent);
  }
}