当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractAdapter::__construct方法代码示例

本文整理汇总了PHP中Zend\Cache\Storage\Adapter\AbstractAdapter::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractAdapter::__construct方法的具体用法?PHP AbstractAdapter::__construct怎么用?PHP AbstractAdapter::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Cache\Storage\Adapter\AbstractAdapter的用法示例。


在下文中一共展示了AbstractAdapter::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructor
  *
  * @param  null|array|Traversable|DbaOptions $options
  * @throws Exception\ExceptionInterface
  */
 public function __construct($options = null)
 {
     if (!extension_loaded('dba')) {
         throw new Exception\ExtensionNotLoadedException('Missing ext/dba');
     }
     parent::__construct($options);
 }
开发者ID:tillk,项目名称:vufind,代码行数:13,代码来源:Dba.php

示例2: __construct

 /**
  * @param null $options
  */
 public function __construct($options = null)
 {
     parent::__construct($options);
     // reset initialized flag on update option(s)
     $initialized =& $this->initialized;
     $this->getEventManager()->attach('option', function ($event) use(&$initialized) {
         $initialized = false;
     });
 }
开发者ID:zf-hipsters,项目名称:key-value-storage,代码行数:12,代码来源:StorageAdapter.php

示例3: __construct

 /**
  * Constructor
  *
  * @param  null|array|Traversable|ApcuOptions $options
  * @throws Exception\ExceptionInterface
  */
 public function __construct($options = null)
 {
     if (version_compare(phpversion('apcu'), '5.1.0', '<')) {
         throw new Exception\ExtensionNotLoadedException('Missing ext/apcu >= 5.1.0');
     }
     if (!ini_get('apc.enabled') || PHP_SAPI === 'cli' && !ini_get('apc.enable_cli')) {
         throw new Exception\ExtensionNotLoadedException("ext/apcu is disabled - see 'apc.enabled' and 'apc.enable_cli'");
     }
     parent::__construct($options);
 }
开发者ID:stephenmoore56,项目名称:mooredatabase-laravel,代码行数:16,代码来源:Apcu.php

示例4: __construct

 /**
  * {@inheritDoc}
  *
  * @throws Exception\ExtensionNotLoadedException
  */
 public function __construct($options = null)
 {
     if (!class_exists('Mongo') || !class_exists('MongoClient')) {
         throw new Exception\ExtensionNotLoadedException('MongoDb extension not loaded or Mongo polyfill not included');
     }
     parent::__construct($options);
     $initialized =& $this->initialized;
     $this->getEventManager()->attach('option', function () use(&$initialized) {
         $initialized = false;
     });
 }
开发者ID:karnurik,项目名称:zf2-turtorial,代码行数:16,代码来源:MongoDb.php

示例5: __construct

 /**
  * Constructor
  *
  * @param  null|array|Traversable|MemcachedOptions $options
  * @throws Exception\ExceptionInterface
  */
 public function __construct($options = null)
 {
     if (static::$extMemcachedMajorVersion === null) {
         $v = (string) phpversion('memcached');
         static::$extMemcachedMajorVersion = $v !== '' ? (int) $v[0] : 0;
     }
     if (static::$extMemcachedMajorVersion < 1) {
         throw new Exception\ExtensionNotLoadedException('Need ext/memcached version >= 1.0.0');
     }
     parent::__construct($options);
 }
开发者ID:royaltyclubvp,项目名称:BuzzyGals,代码行数:17,代码来源:Memcached.php

示例6: __construct

 /**
  * Constructor
  *
  * @param  null|array|Traversable|ApcOptions $options
  * @throws Exception\ExceptionInterface
  */
 public function __construct($options = null)
 {
     $enabled = ini_get('apc.enabled');
     if (PHP_SAPI == 'cli') {
         $enabled = $enabled && (bool) ini_get('apc.enable_cli');
     }
     if (!$enabled) {
         throw new Exception\ExtensionNotLoadedException("ext/apc is disabled - see 'apc.enabled' and 'apc.enable_cli'");
     }
     parent::__construct($options);
 }
开发者ID:CHRISTOPHERVANDOMME,项目名称:zf2complet,代码行数:17,代码来源:Apc.php

示例7: __construct

 /**
  * Constructor
  *
  * @param  null|array|Traversable|MemcachedOptions $options
  * @throws Exception\ExceptionInterface
  */
 public function __construct($options = null)
 {
     if (phpversion('memcached') < 1) {
         throw new Exception\ExtensionNotLoadedException('Need ext/memcached version >= 1.0.0');
     }
     parent::__construct($options);
     // reset initialized flag on update option(s)
     $initialized =& $this->initialized;
     $this->getEventManager()->attach('option', function () use(&$initialized) {
         $initialized = false;
     });
 }
开发者ID:stephenmoore56,项目名称:mooredatabase-laravel,代码行数:18,代码来源:Memcached.php

示例8: __construct

    /**
     * Constructor
     *
     * @param  null|array|Traversable|MemcachedOptions $options
     * @throws Exception\ExceptionInterface
     * @return void
     */
    public function __construct($options = null)
    {
        if (static::$extMemcachedMajorVersion === null) {
            $v = (string) phpversion('memcached');
            static::$extMemcachedMajorVersion = ($v !== '') ? (int)$v[0] : 0;
        }

        if (static::$extMemcachedMajorVersion < 1) {
            throw new Exception\ExtensionNotLoadedException('Need ext/memcached version >= 1.0.0');
        }

        parent::__construct($options);

        // It's ok to init the memcached instance as soon as possible because
        // ext/memcached auto-connects to the server on first use
        $this->memcached = new MemcachedResource();
        $options = $this->getOptions();

        // set lib options
        if (static::$extMemcachedMajorVersion > 1) {
            $this->memcached->setOptions($options->getLibOptions());
        } else {
            foreach ($options->getLibOptions() as $k => $v) {
                $this->memcached->setOption($k, $v);
            }
        }

        $servers = $options->getServers();
        if (!$servers) {
            $options->addServer('127.0.0.1', 11211);
            $servers = $options->getServers();
        }
        $this->memcached->addServers($servers);

        // get notified on change options
        $memc   = $this->memcached;
        $memcMV = static::$extMemcachedMajorVersion;
        $this->events()->attach('option', function ($event) use ($memc, $memcMV) {
            $params = $event->getParams();

            if (isset($params['lib_options'])) {
                if ($memcMV > 1) {
                    $memc->setOptions($params['lib_options']);
                } else {
                    foreach ($params['lib_options'] as $k => $v) {
                        $memc->setOption($k, $v);
                    }
                }
            }

            // TODO: update on change/add server(s)
        });
    }
开发者ID:necrogami,项目名称:zf2,代码行数:60,代码来源:Memcached.php

示例9: __construct

 /**
  * Constructor
  *
  * @param  null|array|Traversable|MemcacheOptions $options
  * @throws Exception\ExceptionInterface
  */
 public function __construct($options = null)
 {
     if (version_compare('2.0.0', phpversion('memcache')) > 0) {
         throw new Exception\ExtensionNotLoadedException("Missing ext/memcache version >= 2.0.0");
     }
     parent::__construct($options);
     // reset initialized flag on update option(s)
     $initialized =& $this->initialized;
     $this->getEventManager()->attach('option', function () use(&$initialized) {
         $initialized = false;
     });
 }
开发者ID:karnurik,项目名称:zf2-turtorial,代码行数:18,代码来源:Memcache.php

示例10: __construct

 /**
  * Create new Adapter for redis storage
  *
  * @param null|array|Traversable|RedisArrayOptions $options
  * @see \Zend\Cache\Storage\Adapter\Abstract
  */
 public function __construct($options = null)
 {
     if (!extension_loaded('redis')) {
         throw new Exception\ExtensionNotLoadedException("Redis extension is not loaded");
     }
     parent::__construct($options);
     // reset initialized flag on update option(s)
     $initialized =& $this->initialized;
     $this->getEventManager()->attach('option', function ($event) use(&$initialized) {
         $initialized = false;
     });
 }
开发者ID:smoke,项目名称:zf2-cache-storage-redis-array,代码行数:18,代码来源:RedisArray.php

示例11: __construct

 /**
  * Constructor
  *
  * @param  null|array|Traversable|XCacheOptions $options
  * @throws Exception\ExceptionInterface
  */
 public function __construct($options = null)
 {
     if (!extension_loaded('xcache')) {
         throw new Exception\ExtensionNotLoadedException('Missing ext/xcache');
     }
     if (PHP_SAPI == 'cli') {
         throw new Exception\ExtensionNotLoadedException("ext/xcache isn't available on SAPI 'cli'");
     }
     if (ini_get('xcache.var_size') <= 0) {
         throw new Exception\ExtensionNotLoadedException("ext/xcache is disabled - see 'xcache.var_size'");
     }
     parent::__construct($options);
 }
开发者ID:karnurik,项目名称:zf2-turtorial,代码行数:19,代码来源:XCache.php

示例12: __construct

 /**
  * Constructor
  *
  * @param  null|array|Traversable|ApcOptions $options
  * @throws Exception\ExceptionInterface
  */
 public function __construct($options = null)
 {
     if (version_compare('3.1.6', phpversion('apc')) > 0) {
         throw new Exception\ExtensionNotLoadedException("Missing ext/apc >= 3.1.6");
     }
     $enabled = ini_get('apc.enabled');
     if (PHP_SAPI == 'cli') {
         $enabled = $enabled && (bool) ini_get('apc.enable_cli');
     }
     if (!$enabled) {
         throw new Exception\ExtensionNotLoadedException("ext/apc is disabled - see 'apc.enabled' and 'apc.enable_cli'");
     }
     parent::__construct($options);
 }
开发者ID:haoyanfei,项目名称:zf2,代码行数:20,代码来源:Apc.php

示例13: __construct

 /**
  * Constructor
  *
  * @param  array|Traversable|WinCacheOptions $options
  * @throws Exception\ExceptionInterface
  */
 public function __construct($options = null)
 {
     if (!extension_loaded('wincache')) {
         throw new Exception\ExtensionNotLoadedException("WinCache extension is not loaded");
     }
     $enabled = ini_get('wincache.ucenabled');
     if (PHP_SAPI == 'cli') {
         $enabled = $enabled && (bool) ini_get('wincache.enablecli');
     }
     if (!$enabled) {
         throw new Exception\ExtensionNotLoadedException("WinCache is disabled - see 'wincache.ucenabled' and 'wincache.enablecli'");
     }
     parent::__construct($options);
 }
开发者ID:CHRISTOPHERVANDOMME,项目名称:zf2complet,代码行数:20,代码来源:WinCache.php

示例14: __construct

 /**
  * Constructor
  *
  * @param  null|array|Traversable|MemcachedOptions $options
  * @throws Exception\ExceptionInterface
  */
 public function __construct($options = null)
 {
     if (static::$extMemcachedMajorVersion === null) {
         $v = (string) phpversion('memcached');
         static::$extMemcachedMajorVersion = $v !== '' ? (int) $v[0] : 0;
     }
     if (static::$extMemcachedMajorVersion < 1) {
         throw new Exception\ExtensionNotLoadedException('Need ext/memcached version >= 1.0.0');
     }
     parent::__construct($options);
     // reset initialized flag on update option(s)
     $initialized =& $this->initialized;
     $this->getEventManager()->attach('option', function ($event) use(&$initialized) {
         $initialized = false;
     });
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:22,代码来源:Memcached.php

示例15: __construct

 /**
  * Constructor
  *
  * @param  null|array|Traversable|MemcachedOptions $options
  * @throws Exception
  * @return void
  */
 public function __construct($options = null)
 {
     if (static::$extMemcachedMajorVersion === null) {
         $v = (string) phpversion('memcached');
         static::$extMemcachedMajorVersion = $v !== '' ? (int) $v[0] : 0;
     }
     if (static::$extMemcachedMajorVersion < 1) {
         throw new Exception\ExtensionNotLoadedException('Need ext/memcached version >= 1.0.0');
     }
     $this->memcached = new MemcachedResource();
     parent::__construct($options);
     // It's ok to add server as soon as possible because
     // ext/memcached auto-connects to the server on first use
     // TODO: Handle multiple servers
     $options = $this->getOptions();
     $this->memcached->addServer($options->getServer(), $options->getPort());
 }
开发者ID:rafalwrzeszcz,项目名称:zf2,代码行数:24,代码来源:Memcached.php


注:本文中的Zend\Cache\Storage\Adapter\AbstractAdapter::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。