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


PHP R::factory方法代码示例

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


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

示例1: getCountKeysInDb

 /**
  * Returns the number of keys in the database
  *
  * @return array
  */
 public static function getCountKeysInDb()
 {
     $dbkeys = array();
     foreach (R::factory()->info() as $key => $value) {
         if (substr($key, 0, 2) == 'db' && ctype_digit(substr($key, 2))) {
             $str = explode(',', $value);
             $str = explode('=', $str[0]);
             $dbkeys[(int) substr($key, 2)] = $str[1];
         }
     }
     return $dbkeys;
 }
开发者ID:xingcuntian,项目名称:readmin,代码行数:17,代码来源:Info.php

示例2: getLast

 public static function getLast($user)
 {
     $key = Config::get('re_prefix') . 'log:' . sha1($user);
     $history = array();
     $uniq = array();
     foreach (R::factory()->lRange($key, -100, -1) as $h) {
         if (!in_array($h, $uniq)) {
             $uniq[] = $h;
             $history[] = array('value' => $h, 'desc' => '');
         }
     }
     return $history;
 }
开发者ID:xingcuntian,项目名称:readmin,代码行数:13,代码来源:History.php

示例3: hDel

 public static function hDel($key, $field)
 {
     return R::factory()->hDel($key, $field);
 }
开发者ID:xingcuntian,项目名称:readmin,代码行数:4,代码来源:Hashes.php

示例4: smembers

 public static function smembers($key)
 {
     $value = R::factory()->sMembers($key);
     $data = array('key' => $key, 'value' => $value);
     return View::factory('tables/smembers', $data);
 }
开发者ID:xingcuntian,项目名称:readmin,代码行数:6,代码来源:Sets.php

示例5: ping

 public function ping()
 {
     $ping = R::factory()->ping();
     $this->notice = View::factory('tables/ping', array('ping' => $ping));
 }
开发者ID:xingcuntian,项目名称:readmin,代码行数:5,代码来源:Command.php

示例6: lRem

 public static function lRem($key, $count, $value)
 {
     // @XXX WARNING, please note the order of arguments
     return R::factory()->lRem($key, $value, (int) $count);
 }
开发者ID:xingcuntian,项目名称:readmin,代码行数:5,代码来源:Lists.php

示例7: error_reporting

 */
error_reporting(E_ALL);
define('APPPATH', dirname(__DIR__) . '/application');
require_once APPPATH . '/classes/Exceptions.php';
/**
 * @TODO SPL::__autoload
 * @param $className
 */
function __autoload($className)
{
    $path = str_replace('_', '/', $className) . '.php';
    if (file_exists(APPPATH . '/classes/' . $path)) {
        require_once APPPATH . '/classes/' . $path;
    }
}
set_exception_handler('exception_handler');
$uri = parse_url(Request::factory()->getUrl(), PHP_URL_PATH);
$uri = substr($uri, 1);
Helper_Auth::auth();
if (!R::factory()->ping()) {
    throw new RedisException('Redis has not connect ' . Config::get('host') . ':' . Config::get('port'));
}
$controller = ucfirst(strstr($uri, '/', true));
$controller = 'Controller_' . ($controller ? $controller : 'Index');
$method = str_replace('/', '', substr(strstr($uri, '/', false), 1));
$method = 'action_' . ($method ? $method : 'index');
if (method_exists($controller, $method)) {
    call_user_func_array(array(new $controller(), $method), array());
} else {
    throw new ExceptionRouter('Not a valid URL : ' . $uri);
}
开发者ID:xingcuntian,项目名称:readmin,代码行数:31,代码来源:index.php

示例8: zRank

 public static function zRank($key, $member)
 {
     return R::factory()->zRank($key, $member);
 }
开发者ID:xingcuntian,项目名称:readmin,代码行数:4,代码来源:ZSets.php

示例9: randomKey

 public static function randomKey()
 {
     return View::factory('tables/randomkey', array('key' => R::factory()->randomKey()));
 }
开发者ID:xingcuntian,项目名称:readmin,代码行数:4,代码来源:Keys.php

示例10: getValue

 public static function getValue($key, $type)
 {
     $size = 0;
     $value = ' ';
     $max = 120;
     if ($type == 'string') {
         $size = R::factory()->strlen($key);
         $value = R::factory()->getRange($key, 0, $max);
         if (strlen($value) > $size) {
             $value .= '..';
         }
     } elseif ($type == 'set') {
         $size = R::factory()->sCard($key);
         $value = '';
         foreach (R::factory()->sMembers($key) as $member) {
             if (strlen($value) < $max - 5) {
                 if (!empty($value)) {
                     $value .= ', ';
                 }
                 $value .= $member;
             } else {
                 $value .= ', ..';
                 break;
             }
         }
         $value = '[ ' . $value . ' ]';
     } elseif ($type == 'zset') {
         $size = R::factory()->zCard($key);
         $value = '';
         foreach (R::factory()->zRange($key, 0, 100, true) as $score => $item) {
             if (strlen($value) < $max - 5) {
                 if (!empty($value)) {
                     $value .= ', ';
                 }
                 $value .= $score . ':' . $item;
             } else {
                 $value .= ', ..';
                 break;
             }
         }
         $value = '[ ' . $value . ' ]';
     } elseif ($type == 'list') {
         $size = R::factory()->lSize($key);
         $value = '';
         foreach (R::factory()->lRange($key, 0, 100) as $item) {
             if (strlen($value) < $max - 5) {
                 if (!empty($value)) {
                     $value .= ', ';
                 }
                 $value .= $item;
             } else {
                 $value = substr($value, 0, $max - 5) . '..';
                 break;
             }
         }
         $value = '[ ' . $value . ' ]';
     } elseif ($type == 'hash') {
         $size = R::factory()->hLen($key);
         $value = '';
         foreach (R::factory()->hKeys($key) as $item) {
             if (strlen($value) < $max - 5) {
                 if (!empty($value)) {
                     $value .= ', ';
                 }
                 $value .= $item;
             } else {
                 $value .= ', ..';
                 break;
             }
         }
         $value = '[ ' . $value . ' ]';
     }
     return array($size, $value);
 }
开发者ID:xingcuntian,项目名称:readmin,代码行数:74,代码来源:Keys.php

示例11: get

 public function get($key)
 {
     $data = array('key' => $key, 'value' => R::factory()->get($key), 'cmd' => 'GET ' . $key);
     return View::factory('tables/get', $data);
 }
开发者ID:xingcuntian,项目名称:readmin,代码行数:5,代码来源:Strings.php


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