《使用Gin框架构建分布式应用》阅读笔记:p101-p107

《用Gin框架构建分布式应用》学习第7天,p101-p107总结,总计7页。

一、技术总结

1.StatusBadRequest vs StatusInternalServerError

写代码的时候有一个问题,什么时候使用 StatusBadRequest(400错误),什么时候使用 StatusInternalServerError(500错误)?

400用于客户端侧的错误(如:传递的参数数量、名称不对),500用于服务端的错误(如:除数是零)。是参考资料:https://developer.mozilla.org/en-US/docs/Web/HTTP/Status。

2.cache(缓存)

使用缓存的直接原因是为了加快查询速度,从而提升用户体验感。所以就在代码中引入了Redis,因为Redis是内存型数据库( in-memory database,使用的是RAM), 而MySQL和MongoDB查询使用的是disk。in-memory只是Redis快的其中一个原因,其它原因未见作者提及。

(1)cache hit(缓存命中)

(2)cache miss(缓存未命中)

二、英语总结

1.metrics

p106, That is why response time is one of the most important metrics to evaluate when developing a RESTful API.

(1)metric: me-(“to measure”)。c.衡量标准。

刚开始晃眼一看以为是“矩阵(matrix)”的意思。

2.tremendous

p106, Let’s imagine that we have a tremendous number of recipes in our MongoDB database.

(1)tremere: to tremble/to shake. Tremere is related to the idea of shaking with fear,这是最开始的意思, 因为害怕等而引起的颤抖。

(2)Hyperbolic or intensive sense of “extraordinarily great or good, immense, such as excites astonishment,” is attested from 1812, paralleling semantic changes in terrific, terrible, dreadful, awful, etc。随着不断的发展,后面又有多出了Hyperbolic or intensive sense(夸张的,或者强烈的意思),表示“巨大的,可怕的”。

三、其它

今天没有什么想说的。

四、参考资料

1. 编程

(1) Mohamed Labouardy,《Building Distributed Applications in Gin》:https://book.douban.com/subject/35610349

2. 英语

(1) Etymology Dictionary:https://www.etymonline.com

(2) Cambridge Dictionary:https://dictionary.cambridge.org

在这里插入图片描述

欢迎搜索及关注:编程人(a_codists)

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值