本文整理汇总了PHP中Redis::close方法的典型用法代码示例。如果您正苦于以下问题:PHP Redis::close方法的具体用法?PHP Redis::close怎么用?PHP Redis::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redis
的用法示例。
在下文中一共展示了Redis::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: close
/**
* Отключение от Redis.
*
* @return void
* @access public
* @static
*/
public static function close()
{
if (static::$redis) {
static::$redis->close();
static::$redis = null;
}
}
示例2: __destruct
public function __destruct()
{
// TODO: Implement __destruct() method.
if (isset($this->redis) && $this->redis instanceof Redis) {
$this->redis->close();
}
}
示例3: tearDown
public function tearDown()
{
if ($this->redis) {
$this->redis->close();
}
// unset($this->redis);
}
示例4: __destruct
public function __destruct()
{
if ($this->instance) {
$this->instance->close();
unset($this->instance);
}
}
示例5: tearDownAfterClass
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
self::clear(self::$conn);
self::$conn->close();
self::$conn = null;
}
示例6: connect
/**
* connect to redis server
*
* @param string $host
* @param integer $port
* @param integer $timeout
* @throws Tinebase_Exception_Backend
*/
public function connect($host = null, $port = null, $timeout = null)
{
if ($this->_redis instanceof Redis) {
$this->_redis->close();
}
$host = $host ? $host : $this->_options['host'];
$port = $port ? $port : $this->_options['port'];
$timeout = $timeout ? $timeout : $this->_options['timeout'];
$this->_redis = new Redis();
if (!$this->_redis->connect($host, $port, $timeout)) {
throw new Tinebase_Exception_Backend('Could not connect to redis server at ' . $host);
}
}
示例7: initModules
function initModules($application)
{
$redis = new Redis();
$redis->connect(CACHE_HOSTNAME, CACHE_PORT);
$redis->select(CACHE_DB);
$modulesKey = $application . '-modules';
$modules = $redis->get($modulesKey);
if (empty($modules)) {
$modules = [];
$dir = __DIR__ . '/../../' . $application . '/modules';
$dirpath = realpath($dir);
$filenames = scandir($dir);
foreach ($filenames as $filename) {
if ($filename == '.' || $filename == '..') {
continue;
}
if (is_file($dirpath . DIRECTORY_SEPARATOR . $filename . '/Module.php')) {
$modules[strtolower($filename)] = ['class' => $application . '\\modules\\' . $filename . '\\Module'];
}
}
$redis->set($modulesKey, serialize([$modules, null]));
} else {
$modules = unserialize($modules);
if (!empty($modules[0])) {
$modules = $modules[0];
}
}
$redis->close();
return $modules;
}
示例8: __destruct
public function __destruct() {
try {
if ($this->_redis) {
$this->_redis->close();
}
} catch (Exception $e) {}
}
示例9: finish
/**
* {@inheritDoc}
* @see \Mcustiel\SimpleCache\Interfaces\CacheInterface::finish()
*/
public function finish()
{
if ($this->connection !== null) {
$this->connection->close();
$this->connection = null;
}
}
示例10: process
public function process()
{
$this->params['output'] = 'json';
$context = \CADB\Model\Context::instance();
if (!($rdb = $context->getProperty('service.redis'))) {
$this->result = array('found' => false, 'error' => "자동완성 기능이 활성화되어 있지 않습니다.");
} else {
if (!$this->params['q']) {
$this->result = array('found' => false, 'error' => "자동완성할 키워드를 입력하세요.");
} else {
$redis = new \Redis();
try {
$redis->connect('127.0.0.1', '6379', 2.5, NULL, 150);
if ($redis->select($rdb) == false) {
$this->result = array('found' => false, 'error' => "index 1 database 에 연결할 수 없습니다.");
} else {
$this->recommand = $redis->zRange($this->params['q'], 0, -1);
if (@count($this->recommand)) {
$this->result = array('found' => true, 'total_cnt' => @count($this->recommand));
} else {
$this->result = array('found' => true, 'total_cnt' => 0);
}
}
} catch (RedisException $e) {
var_dump($e);
}
$redis->close();
}
}
}
示例11: close
/**
*
*/
public function close()
{
if ($this->_socket) {
$this->_socket->close();
$this->_socket = null;
}
}
示例12: __destruct
/**
* Class destructor
*
* Closes the connection to Redis if present.
*
* @return void
*/
public function __destruct()
{
// if ($this->_redis && $this->is_supported())
if ($this->_redis) {
$this->_redis->close();
}
}
示例13: close
/**
* Closes a connection.
*
* @return bool Always true
*/
public function close()
{
if ($this->isConnected()) {
$this->_connection->close();
}
$this->connected = false;
$this->_connection = null;
return true;
}
示例14: srvc_redis_dump_info
function srvc_redis_dump_info()
{
// https://github.com/phpredis/phpredis#close
$redis = new Redis();
$redis->connect('127.0.0.1');
$redis_info = $redis->info();
$redis->close();
$json = json_encode($redis_info);
echo "{$json}";
}
示例15: close
public function close()
{
if ($this->_connected) {
try {
$this->_redis->close();
} catch (Exception $e) {
}
$this->_connected = false;
}
}