本文整理汇总了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);
}
}
示例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();
}
示例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'] = [];
}
}
示例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'];
}
示例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];
}
}
示例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();
}
示例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';
}
示例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';
}
示例9: __construct
/**
* {@inheritdoc}
*/
public function __construct($imageFilename)
{
parent::__construct($imageFilename);
$this->imagick = new \Imagick($this->getImageFileName());
}
示例10: __construct
/**
* @param array $params
*/
public function __construct(array $params = array())
{
$this->ensureModuleExistence();
parent::__construct($params);
}
示例11: __construct
public function __construct($uriBase = null, $params = null)
{
$this->setEnv($_GET);
parent::__construct($uriBase, $params);
}
示例12: __construct
public function __construct($proxyConfig)
{
parent::__construct($proxyConfig);
}
示例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);
}
示例14: __construct
public function __construct(\Memcached $client, $namespace = '', $defaultLifetime = 0)
{
parent::__construct($namespace, $defaultLifetime);
$this->client = $client;
}
示例15: __construct
public function __construct($namespace = '', $defaultLifetime = 0, $directory = null)
{
parent::__construct('', $defaultLifetime);
$this->init($namespace, $directory);
}