one 1.4.1 发布,基于 Swoole 的极简常驻内存框架

栏目: 软件资讯 · 发布时间: 7年前

内容简介:One - 一个极简的基于swoole常驻内存框架 github: https://github.com/lizhichao/one 码云:https://gitee.com/vicself/one 1.4.1 发布: 优化 优化uuid生成规则 修复 缓存驱动为file时 notice错误 增加 允许在模...

One - 一个极简的基于swoole常驻内存框架

github: https://github.com/lizhichao/one

码云:https://gitee.com/vicself/one

1.4.1 发布:

优化

  • 优化uuid生成规则

修复

  • 缓存驱动为file时 notice错误

增加

  • 允许在模型自己创建查询构造器链式调用

class Article extends Model
{
    CONST TABLE = 'articles';

    public function week()
    {
        return $this->where('create_at', '>', strtotime('-1 week'));
    }

    /**
     * 根据点赞排序
     */
    public function orderByLikeCount()
    {
        return $this->orderBy('like_count', 'desc');
    }

}

// 获取周排行榜 按照点赞数量
Article::column(['id','title'])->where('create_at', '>', strtotime('-1 week'))->orderBy('like_count', 'desc')->limit(10)->findAll();

// 通过自己创建的查询构造器
Article::column(['id','title'])->week()->orderByLikeCount()->limit(10)->findAll();
  • 添加rpc 方法 支持数组

// 添加方法`method1`,`method2` 供远程客户端调用

RpcServer::add(Abc::class,'method1');
RpcServer::add(Abc::class,'method2');

// 现在可以这么写
RpcServer::add(Abc::class,['method1','method2']);
  • 队列固定长度

$global_data = new \App\GlobalData\Client();
// 设置队为固定长度
$global_data->setQueueLimit(3);
$arr = [1, 2, 3, 4, 5];
foreach ($arr as $i) {
    $global_data->push('abc', $i);
}

while (1) {
    $ret = $global_data->pop('abc');
    if ($ret !== null) {
        echo $ret . PHP_EOL;
    } else {
        break;
    }
}

//以上输出
//3
//4
//5

//删除固定长度限制
$global_data->delQueueLimit('abc');

以上所述就是小编给大家介绍的《one 1.4.1 发布,基于 Swoole 的极简常驻内存框架》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Mechanics of Web Handling

The Mechanics of Web Handling

David R. Roisum

This unique book covers many aspects of web handling for manufacturing, converting, and printing. The book is applicable to any web including paper, film, foil, nonwovens, and textiles. The Mech......一起来看看 《The Mechanics of Web Handling》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具