一、基本概念
1. Cache(缓存): 从cpu的一级和二级缓存、Internet的DNS、到浏览器缓存都可以看做是一种缓存。
维基百科: 写道
a store of things that will be required in the future, and can be retrieved rapidly.
(存贮数据(使用频繁的数据)的临时地方,因为取原始数据的代价太大了,所以我可以取得快一些)

2. Cache hit(缓存命中)(下图左)
When a data element is requested from cache and the elements exists for the given key.
3. Cahe miss(缓存未命中): 与Cache hit相反(下图右)

4. 缓存算法:缓存容量超过预设,如何踢掉“无用”的数据。
例如:LRU(Least Recently Used) FIFO(First Input First Output)Least Frequently Used(LFU) 等等
5. System-of-Record(真实数据源): 例如关系型数据库、其他持久性系统等等。
也有英文书叫做authority data(权威数据)
6. serialization-and-deserialization(序列化与反序列化):可以参考:序列化与反序列化(美团工程师写的,非常棒的文章)
后面也有单独文章去分析。

6. Scale Up (垂直扩容) 和 Scale out (水平扩容)
驴拉车,通常不是把一头驴养壮(有极限),而通常是一群驴去拉(当然每个个体也不能太差)。

服务器也是一样的道理,至少互联网是这样:

7. Write-through 和 write-behind


8.阿姆而达定律:用于计算缓存加速比
二、缓存的种类或者类型
1. LocalCache(独立式): 例如Ehcache、BigMemory Go
(1) 缓存和应用在一个JVM中。
(2) 缓存间是不通信的,独立的。
(3) 弱一致性。

2. Standalone(单机):
(1) 缓存和应用是独立部署的。
(2) 缓存可以是单台。(例如memcache/redis单机等等)
(3) 强一致性
(4) 无高可用、无分布式。
(5) 跨进程、跨网络

3. Distributed(分布式):例如Redis-Cluster, memcache集群等等
(1) 缓存和应用是独立部署的。
(2) 多个实例。(例如memcache/redis等等)
(3) 强一致性或者最终一致性
(4) 支持Scale Out、高可用。
(5) 跨进程、跨网络

4. Replicated(复制式): 缓存数据时同时存放在多个应用节点的,数据复制和失效的事件以同步或者异步的形式在各个集群节点间传播。(也是弱一致性)
这种用的不太多。
三、数据层访问速度:(作为开发人员要记住这些量级)
