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


PHP AbstractAdapter::__construct方法代码示例

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


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

示例1: __construct

 /**
  * Constructor
  *
  * Instantiate the cache db object
  *
  * @param  string  $db
  * @param  int     $lifetime
  * @param  string  $table
  * @param  boolean $pdo
  * @throws Exception
  * @return Sqlite
  */
 public function __construct($db, $lifetime = 0, $table = 'pop_cache', $pdo = false)
 {
     parent::__construct($lifetime);
     $this->setDb($db);
     $pdoDrivers = class_exists('Pdo', false) ? \PDO::getAvailableDrivers() : [];
     if (!class_exists('Sqlite3', false) && !in_array('sqlite', $pdoDrivers)) {
         throw new Exception('Error: SQLite is not available.');
     } else {
         if ($pdo && !in_array('sqlite', $pdoDrivers)) {
             $pdo = false;
         } else {
             if (!$pdo && !class_exists('Sqlite3', false)) {
                 $pdo = true;
             }
         }
     }
     if ($pdo) {
         $this->sqlite = new \PDO('sqlite:' . $this->db);
         $this->isPdo = true;
     } else {
         $this->sqlite = new \SQLite3($this->db);
     }
     if (null !== $table) {
         $this->setTable($table);
     }
 }
开发者ID:popphp,项目名称:pop-cache,代码行数:38,代码来源:Sqlite.php

示例2: __construct

 /**
  * Constructor
  *
  * Instantiate the APC cache object
  *
  * @param  int $lifetime
  * @throws Exception
  * @return Apc
  */
 public function __construct($lifetime = 0)
 {
     parent::__construct($lifetime);
     if (!function_exists('apc_cache_info')) {
         throw new Exception('Error: APC is not available.');
     }
     $this->info = apc_cache_info();
 }
开发者ID:popphp,项目名称:pop-cache,代码行数:17,代码来源:Apc.php

示例3: __construct

 /**
  * Constructor
  *
  * Instantiate the cache session object
  *
  * @param  int $lifetime
  * @return Session
  */
 public function __construct($lifetime = 0)
 {
     parent::__construct($lifetime);
     if (session_id() == '') {
         session_start();
     }
     if (!isset($_SESSION['_POP_CACHE'])) {
         $_SESSION['_POP_CACHE'] = [];
     }
 }
开发者ID:popphp,项目名称:pop-cache,代码行数:18,代码来源:Session.php

示例4: __construct

 /**
  * Constructor
  *
  * Instantiate the memcache cache object
  *
  * @param  int    $lifetime
  * @param  string $host
  * @param  int    $port
  * @throws Exception
  * @return Redis
  */
 public function __construct($lifetime = 0, $host = 'localhost', $port = 6379)
 {
     parent::__construct($lifetime);
     if (!class_exists('Redis', false)) {
         throw new Exception('Error: Redis is not available.');
     }
     $this->redis = new \Redis();
     if (!$this->redis->connect($host, (int) $port)) {
         throw new Exception('Error: Unable to connect to the memcached server.');
     }
     $this->version = $this->redis->info()['redis_version'];
 }
开发者ID:popphp,项目名称:pop-cache,代码行数:23,代码来源:Redis.php

示例5: __construct

 /**
  * Constructor
  *
  * Instantiate the memcached cache object
  *
  * @param  int    $lifetime
  * @param  string $host
  * @param  int    $port
  * @param  int    $weight
  * @throws Exception
  * @return Memcached
  */
 public function __construct($lifetime = 0, $host = 'localhost', $port = 11211, $weight = 1)
 {
     parent::__construct($lifetime);
     if (!class_exists('Memcached', false)) {
         throw new Exception('Error: Memcached is not available.');
     }
     $this->memcached = new \Memcached();
     $this->addServer($host, $port, $weight);
     $version = $this->memcached->getVersion();
     if (isset($version[$host . ':' . $port])) {
         $this->version = $version[$host . ':' . $port];
     }
 }
开发者ID:popphp,项目名称:pop-cache,代码行数:25,代码来源:Memcached.php

示例6: __construct

 /**
  * Constructor
  *
  * Instantiate the memcache cache object
  *
  * @param  int    $lifetime
  * @param  string $host
  * @param  int    $port
  * @throws Exception
  * @return Memcache
  */
 public function __construct($lifetime = 0, $host = 'localhost', $port = 11211)
 {
     parent::__construct($lifetime);
     if (!class_exists('Memcache', false)) {
         throw new Exception('Error: Memcache is not available.');
     }
     $this->memcache = new \Memcache();
     if (!$this->memcache->connect($host, (int) $port)) {
         throw new Exception('Error: Unable to connect to the memcache server.');
     }
     $this->version = $this->memcache->getVersion();
 }
开发者ID:popphp,项目名称:pop-cache,代码行数:23,代码来源:Memcache.php

示例7: __construct

 public function __construct($config)
 {
     parent::__construct($config);
     $this->socialFieldsMap = array('socialId' => 'id', 'email' => 'default_email', 'name' => 'real_name', 'socialPage' => 'link', 'avatar' => 'picture', 'sex' => 'sex', 'birthday' => 'birthday');
     $this->provider = 'yandex';
 }
开发者ID:berpcor,项目名称:sauth,代码行数:6,代码来源:Yandex.php

示例8: __construct

 public function __construct($config)
 {
     parent::__construct($config);
     $this->socialFieldsMap = array('socialId' => 'uid', 'email' => 'email', 'name' => 'nick', 'socialPage' => 'link', 'avatar' => 'pic_big', 'birthday' => 'birthday');
     $this->provider = 'mailru';
 }
开发者ID:egorlost,项目名称:mysite,代码行数:6,代码来源:Mailru.php

示例9: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct($imageFilename)
 {
     parent::__construct($imageFilename);
     $this->imagick = new \Imagick($this->getImageFileName());
 }
开发者ID:webowy,项目名称:zend-filter,代码行数:8,代码来源:Imagick.php

示例10: __construct

 /**
  * @param array $params
  */
 public function __construct(array $params = array())
 {
     $this->ensureModuleExistence();
     parent::__construct($params);
 }
开发者ID:mimmi20,项目名称:wurflcache,代码行数:8,代码来源:Apc.php

示例11: __construct

 public function __construct($uriBase = null, $params = null)
 {
     $this->setEnv($_GET);
     parent::__construct($uriBase, $params);
 }
开发者ID:crapougnax,项目名称:t41,代码行数:5,代码来源:GetAdapter.php

示例12: __construct

 public function __construct($proxyConfig)
 {
     parent::__construct($proxyConfig);
 }
开发者ID:koTool,项目名称:WhoisParser,代码行数:4,代码来源:Http.php

示例13: __construct

 /**
  * Constructor
  *
  * Instantiate the cache file object
  *
  * @param  string $dir
  * @param  int    $lifetime
  * @return File
  */
 public function __construct($dir, $lifetime = 0)
 {
     parent::__construct($lifetime);
     $this->setDir($dir);
 }
开发者ID:popphp,项目名称:pop-cache,代码行数:14,代码来源:File.php

示例14: __construct

 public function __construct(\Memcached $client, $namespace = '', $defaultLifetime = 0)
 {
     parent::__construct($namespace, $defaultLifetime);
     $this->client = $client;
 }
开发者ID:symfony,项目名称:symfony,代码行数:5,代码来源:MemcachedAdapter.php

示例15: __construct

 public function __construct($namespace = '', $defaultLifetime = 0, $directory = null)
 {
     parent::__construct('', $defaultLifetime);
     $this->init($namespace, $directory);
 }
开发者ID:ayoah,项目名称:symfony,代码行数:5,代码来源:FilesystemAdapter.php


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