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


PHP Redis::info方法代码示例

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


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

示例1: doGetStats

 /**
  * {@inheritdoc}
  */
 protected function doGetStats()
 {
     $stats = $this->redis->info();
     $statsHits = isset($stats['keyspace_hits']) ? $stats['keyspace_hits'] : $stats['Stats']['keyspace_hits'];
     $statsMisses = isset($stats['keyspace_misses']) ? $stats['keyspace_misses'] : $stats['Stats']['keyspace_misses'];
     $statsMemoryUsage = isset($stats['used_memory']) ? $stats['used_memory'] : $stats['Memory']['used_memory'];
     $statsUptime = isset($stats['uptime_in_seconds']) ? $stats['uptime_in_seconds'] : $stats['Server']['uptime_in_seconds'];
     return array(Cache::STATS_HITS => $statsHits, Cache::STATS_MISSES => $statsMisses, Cache::STATS_UPTIME => $statsUptime, Cache::STATS_MEMORY_USAGE => $statsMemoryUsage, Cache::STATS_MEMORY_AVAILIABLE => null);
 }
开发者ID:slaparra,项目名称:voting-details,代码行数:12,代码来源:RedisCache.php

示例2: status

 /**
  * @inheritdoc
  */
 public function status()
 {
     $info = $this->redis->info();
     $status[self::HITS] = 0;
     $status[self::MISSES] = 0;
     $status[self::START_TIME] = isset($info['uptime_in_seconds']) ? $info['uptime_in_seconds'] : 0;
     $status[self::MEMORY_USED] = isset($info['used_memory']) ? $info['used_memory'] : 0;
     $status[self::MEMORY_LEFT] = 0;
     return $status;
 }
开发者ID:lixiongyou,项目名称:pudding,代码行数:13,代码来源:Redis.php

示例3: __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

示例4: _getStats

 /**
  * {@inheritDoc}
  *
  * @link https://github.com/phpredis/phpredis#info
  *
  * Does some minor transformation to ensure a baseline of info between Memcache and Redis
  */
 protected function _getStats()
 {
     $info = $this->_connection->info();
     // Ensure info keyspace is populated before returning
     $defaults = ['keyspace_hits' => 0, 'keyspace_misses' => 0, 'evicted_keys' => 0, 'maxmemory' => 0, 'process_id' => 0, 'uptime_in_seconds' => 0, 'lru_clock' => 0, 'redis_version' => 0, 'total_system_memory' => 0, 'connected_clients' => 0, 'total_commands_processed' => 0, 'total_net_input_bytes' => 0, 'total_net_output_bytes' => 0];
     $info = array_merge($defaults, $info);
     $info['get_hits'] = $info['keyspace_hits'];
     $info['get_misses'] = $info['keyspace_misses'];
     $info['evictions'] = $info['evicted_keys'];
     $info['pointer_size'] = $info['maxmemory'];
     $info['pid'] = $info['process_id'];
     $info['uptime'] = $info['uptime_in_seconds'];
     $info['time'] = $info['lru_clock'];
     $info['version'] = $info['redis_version'];
     $info['bytes'] = 0;
     $info['bytes_read'] = $info['total_net_output_bytes'];
     $info['bytes_written'] = $info['total_net_input_bytes'];
     $info['limit_maxbytes'] = $info['total_system_memory'];
     $info['curr_items'] = 0;
     $info['total_items'] = 0;
     $info['curr_connections'] = $info['connected_clients'];
     $info['total_connections'] = $info['total_commands_processed'];
     $info['cmd_get'] = $info['keyspace_hits'];
     $info['cmd_set'] = 0;
     return $info;
 }
开发者ID:behance,项目名称:nbd.php-cache,代码行数:33,代码来源:RedisAdapter.php

示例5: _overview_all

 /**
  * 查看全部服务器
  */
 private function _overview_all()
 {
     $info = array();
     foreach ($this->server_list as $i => $server) {
         if (isset($server['cluster_list'])) {
             $info[$i]['error'] = FALSE;
             $info[$i]['cluster_list'] = $server['cluster_list'];
             continue;
         }
         $redis = new Redis();
         $can_connect = FALSE;
         try {
             $can_connect = $redis->connect($server['host'], $server['port'], 0.5);
         } catch (Exception $e) {
             $can_connect = TRUE;
         }
         $info[$i] = array('error' => FALSE);
         if (!$can_connect) {
             $info[$i]['error'] = TRUE;
         } else {
             $info[$i] = array_merge($info[$i], $redis->info());
             $info[$i]['size'] = $redis->dbSize();
         }
     }
     $page_data['info'] = $info;
     $page_data['server_list'] = $this->server_list;
     $page_data['title'] = '服务器一览表';
     $this->load->view('overview', $page_data);
 }
开发者ID:RyeZhu,项目名称:RedisMyAdmin,代码行数:32,代码来源:overview.php

示例6: get_keyspace_count

 /**
  * Scan and variants
  */
 protected function get_keyspace_count($str_db)
 {
     $arr_info = $this->redis->info();
     $arr_info = $arr_info[$str_db];
     $arr_info = explode(',', $arr_info);
     $arr_info = explode('=', $arr_info[0]);
     return $arr_info[1];
 }
开发者ID:remicollet,项目名称:phpredis,代码行数:11,代码来源:TestRedis.php

示例7: testinfo

 public function testinfo()
 {
     $info = $this->redis->info();
     $keys = array("redis_version", "arch_bits", "uptime_in_seconds", "uptime_in_days", "connected_clients", "connected_slaves", "used_memory", "changes_since_last_save", "bgsave_in_progress", "last_save_time", "total_connections_received", "total_commands_processed", "role");
     foreach ($keys as $k) {
         $this->assertTrue(in_array($k, array_keys($info)));
     }
 }
开发者ID:0,项目名称:phpredis,代码行数:8,代码来源:TestRedis.php

示例8: 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}";
}
开发者ID:henern,项目名称:too_studio_wx,代码行数:10,代码来源:srvc_redis_api.php

示例9: serverStatistics

 /**
  * Get cache server statistics.
  *
  * @return array|string
  * @access public
  */
 public function serverStatistics()
 {
     if ($this->connected === true && $this->ping() === true) {
         if ($this->isRedis === true) {
             return $this->server->info();
         } else {
             return $this->server->getStats();
         }
     }
     return array();
 }
开发者ID:sebst3r,项目名称:nZEDb,代码行数:17,代码来源:Cache.php

示例10: verifyRedisVersionIsSupported

 /**
  * @return void
  * @throws CacheException
  */
 protected function verifyRedisVersionIsSupported()
 {
     // Redis client could be in multi mode, discard for checking the version
     $this->redis->discard();
     $serverInfo = $this->redis->info();
     if (!isset($serverInfo['redis_version'])) {
         throw new CacheException('Unsupported Redis version, the Redis cache backend needs at least version ' . self::MIN_REDIS_VERSION, 1438251553);
     }
     if (version_compare($serverInfo['redis_version'], self::MIN_REDIS_VERSION) < 0) {
         throw new CacheException('Redis version ' . $serverInfo['redis_version'] . ' not supported, the Redis cache backend needs at least version ' . self::MIN_REDIS_VERSION, 1438251628);
     }
 }
开发者ID:mkeitsch,项目名称:flow-development-collection,代码行数:16,代码来源:RedisBackend.php

示例11: testInfoCommandStats

 public function testInfoCommandStats()
 {
     // INFO COMMANDSTATS is new in 2.6.0
     if (version_compare($this->version, "2.5.0", "lt")) {
         $this->markTestSkipped();
     }
     $info = $this->redis->info("COMMANDSTATS");
     $this->assertTrue(is_array($info));
     if (is_array($info)) {
         foreach ($info as $k => $value) {
             $this->assertTrue(strpos($k, 'cmdstat_') !== false);
         }
     }
 }
开发者ID:stonegithubs,项目名称:phpredis,代码行数:14,代码来源:TestRedis.php

示例12: skip

 /**
  * Skip the test if the Redis extension is unavailable.
  *
  * @return void
  */
 public function skip()
 {
     $this->skipIf(!Redis::enabled(), 'The redis extension is not installed.');
     $redis = new RedisCore();
     $cfg = $this->_config;
     try {
         $redis->connect($cfg['host'], $cfg['port']);
     } catch (Exception $e) {
         $info = $redis->info();
         $msg = "redis-server does not appear to be running on {$cfg['host']}:{$cfg['port']}";
         $this->skipIf(!$info, $msg);
     }
     unset($redis);
 }
开发者ID:newmight2015,项目名称:Blockchain-2,代码行数:19,代码来源:RedisTest.php

示例13: serverStatistics

 /**
  * Get cache server statistics.
  *
  * @return array
  * @access public
  */
 public function serverStatistics()
 {
     if ($this->ping()) {
         switch (NN_CACHE_TYPE) {
             case self::TYPE_REDIS:
                 return $this->server->info();
             case self::TYPE_MEMCACHED:
                 return $this->server->getStats();
             case self::TYPE_APC:
                 return apc_cache_info();
         }
     }
     return array();
 }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:20,代码来源:Cache.php

示例14: status

 /**
  * Get cache status
  *
  * @return  array
  */
 public function status()
 {
     $enabled = $this->isEnabled();
     if (!$enabled) {
         return array("provider" => "phpredis", "enabled" => $enabled, "objects" => null, "options" => array());
     }
     $objects = 0;
     $options = array();
     $this->resetErrorState();
     try {
         $objects = $this->instance->dbSize();
         $options = $this->instance->info();
     } catch (RedisException $re) {
         $this->raiseError("Server unreachable (PhpRedis), exiting gracefully", array("RESULTCODE" => $re->getCode(), "RESULTMESSAGE" => $re->getMessage()));
         $this->setErrorState();
         $enabled = false;
     }
     return array("provider" => "phpredis", "enabled" => $enabled, "objects" => $objects, "options" => $options);
 }
开发者ID:comodojo,项目名称:cache,代码行数:24,代码来源:PhpRedisCache.php

示例15: connect

 /**
  * 连接数据库方法
  * @access public
  */
 public function connect($config = '', $linkNum = 0)
 {
     if (!isset($this->linkID[$linkNum])) {
         if (empty($config)) {
             $config = $this->config;
         }
         $redis = new Redis();
         $redis->connect($config["REDIS_HOST"] ? $config["REDIS_HOST"] : "localhost", $config["REDIS_PORT"] ? $config["REDIS_PORT"] : 6379);
         $redis->auth($config["REDIS_AUTH"] ? $config["REDIS_AUTH"] : "");
         $info = $redis->info();
         // 标记连接成功
         if (!empty($info["redis_version"])) {
             $this->linkID[$linkNum] = $redis;
             $this->connected = true;
         }
         // 注销数据库连接配置信息
         if (1 != C('DB_DEPLOY_TYPE')) {
             unset($this->config);
         }
     }
     return $this->linkID[$linkNum];
 }
开发者ID:tearys,项目名称:php1,代码行数:26,代码来源:DbRedis.class.php


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