diff --git a/notes/pics/bloom-filter.png b/notes/pics/bloom-filter.png new file mode 100644 index 00000000..6937dad6 Binary files /dev/null and b/notes/pics/bloom-filter.png differ diff --git a/notes/pics/lru.png b/notes/pics/lru.png new file mode 100644 index 00000000..38da77b8 Binary files /dev/null and b/notes/pics/lru.png differ diff --git a/notes/缓存.md b/notes/缓存.md index 1a6cffa1..08831347 100644 --- a/notes/缓存.md +++ b/notes/缓存.md @@ -97,6 +97,10 @@ CDN 主要有以下优点: - 对这些不存在的数据缓存一个空数据,并设置较短的过期时间; - 使用布隆过滤器保存所有存在的 Key,对不存在的 Key 的请求直接拒绝。 +布隆过滤器用多个哈希函数把 Key 映射到位数组的多个位置并置为 1。查询时只要有一个位置为 0,Key 就一定不存在;全部为 1 时 Key 可能存在,存在一定的误判率。 + +