one 1.4.1 釋出,基於 Swoole 的極簡常駐記憶體框架
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');