Laravel chunk 使用注意的问题

使用 Laravel 的 chunk 可以用来优化大结果集的查询,提供分块处理数据的方法,但是如下的例子就会有问题: 1 2 3 4 5 User::where('approved', 0)->chunk(100, function ($users) { foreach ($users as $user) { $user->update(['approved' => 1]); } }); 原因在于第一

Laravel 中为何不使用 blpop 取队列?

Redis 的 list 数据结构常用来做消息队列,通常使用的命令有 lpop/rpop ,还有带阻塞版的 blpop/brpop 等。blpop 的优点是避免一直轮询占用资源,而且支持多个列表作为参数并按照顺序弹出数据,如 blpop high low 30,可以更方便实现队列的优先级。

本周阅读清单20180723

1.GoLang: When to use string pointers https://dhdersch.github.io/golang/2016/01/23/golang-when-to-use-string-pointers.html 2.PHP 7.3 中的 JSON 错误处理 https://laravel-china.org/topics/14668/json-error-handling-in-php-73 3.如何设计、开发和部署微服务(Nginx 官方文章翻译) https://www.cnblogs.com/ajianbeyourself/p/5976664.html 4.理解 Laravel 中的 pipeline ① https://www.insp.top/article/realization-of-pipeline-component-for-laravel ② https://www.jianshu.com/p/3c2791a525d0 5.Redis 哈希对象编码方式 http://redisbook.com/preview/object/hash.html 6.

本周阅读清单20180716

1.初探 Go 的编译命令执行过程 https://halfrost.com/go_command/ 2.高效的数据压缩编码方式——Protobuf https://halfrost.com/protobuf_encode/ 3.浅谈消息队列及常见的消息中间件 https://juejin.im/post/5b41fe36e51d45191252e79e 4.深入理解 PHP 的输出缓冲区

本周阅读清单20180709

1.深入浅出 TCP/IP 协议栈 http://dxyoo7.github.io/2017/07/21/u-should-know-protocol-of-tcp-ip/ 2.中国工业 4.0 之路 http://www.mckinsey.com.cn/中国工业4-0之路 3.MySQL 查询缓存机制 https://blog.csdn.net/eric_sunah/article/details/17510939 4.MySQL 体系结构 http://www.cnblogs.com/chenmh/p/4914754.html

本周阅读清单20180702

1.HTTP/2 服务器推送(server push)教程 https://juejin.im/entry/5a9e61cc518825556140c4f2 2.如何优雅的谈论 HTTP 1.0,1.1 和 HTTP/2 https://www.jianshu.com/p/52d86558ca57 3.深入理解 RESTful API 架构 https://mengkang.net/620.html 4.传统 Web 应用中的身份验证技术 https://insights.thoughtworks.cn/traditional-web-app-authentication/ 5.Web App Token 鉴权方案的

本周阅读清单20180619

1.MySQL 索引背后的数据结构及算法原理 https://juejin.im/entry/591012d161ff4b006255b447 2.微信扫码登录原理 https://blog.csdn.net/qq_25827845/article/details/78823861 3.Redis 事务及 Watch 的实现原理 http://redisbook.readthedocs.io/en/latest/feature/transaction.html 4.Redis 事务到底是不是原子性的 https://blog.tanteng.me/2018/06/redis-transaction-atomic/ 5.LRU 缓存淘汰算法数据结构 https://zhuanlan.zhihu.com/p/34989978 6.Singleton Pattern in Go http://marcio.io/2015/07/singleton-pattern-in-go/

本周阅读清单20180604

1.深入介绍 Golang 中的 bufio.Scanner https://zhuanlan.zhihu.com/p/37673679 2.Redis 的通信协议 http://redisdoc.com/topic/protocol.html 3.用 Redis 实现支持优先级的消息队列 https://www.cnblogs.com/laozhbook/p/redis_queue.html 4.Go HTTP 服务器编程基础 http://cizixs.com/2016/08/17/golang-http-server-side 5.你真的了解 gzip 吗? https://zhuanlan.zhihu.com/p/24764131

本周阅读清单20180528

1.在 Laravel 中使用 Vue 组件化开发 https://pigjian.com/article/laravel-vue 2.理解 PHP 内核中 SAPI 的作用 https://foio.github.io/php-sapi/ 3.使用 Redis 实现单机锁 https://huoding.com/2015/09/14/463 4.使用 Redis 实现分布式锁 http://blog.jobbole.com/95211/

本周阅读清单20180514

1.Go语言中的错误处理 http://ethancai.github.io/2017/12/29/Error-Handling-in-Go/ 2.深入理解 PHP opcode 优化 https://tech.youzan.com/understanding-opcode-optimization-in-php/ 3.基于timestamp和nonce的防止重放攻击方案 https://blog.csdn.net/koastal/article/details/53456696 4.一个防止重放攻击的 Laravel package https://github.com/ruogoo/replay-attack 5.理

本周阅读清单20180507

1.Golang CSP 并发模型 https://www.jianshu.com/p/36e246c6153d 2.深入理解 Go Channel http://legendtkl.com/2017/07/30/understanding-golang-channel/ 3.谈谈 HTTP/2 的协议协商机制 https://imququ.com/post/protocol-negotiation-in-http2.html 4.【重温】中本聪《比特币:一种点对点的电子现金系统》 https://zhuanlan.zhihu.com/p/28108862 5.详解区块链 P2P 网络 https://keeganlee.me/post/blockchain/20180313 6.