當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。