🧊 前沿科技知识库
全部 / 软件工程

缓存与存储策略(Caching and Storage Strategies)

2026-09-26 · 软件工程
最后更新:2026-09-26 | 领域:软件工程 | 说明:信息来源为公开网络资料,详见文末参考来源

概述

缓存的本质是在更快的介质上保存数据的副本,以降低延迟、减少对下游(数据库、源站)的压力。它同时引入三个必须面对的问题:一致性(副本何时过期)、容量(保存什么、淘汰什么)与可靠性(缓存故障时系统如何降级)。

在架构层面,缓存通常按层级组织:进程内缓存(L1,节点本地、微秒级、无网络开销)、分布式缓存(L2,集群共享、毫秒级)、数据库/源站作为唯一事实来源(Application-Level Caching)。本地缓存的劣势是受实例内存限制、且各实例各持一份副本,若管理不当会导致数据不一致(Mastering Advanced Caching: Redis, Caffeine, and Multi-Layer Architectures)。

最新进展(2025–2026)

1. Redis 8 正式发布,引入面向 AI 的数据类型。 Redis 8 GA 版本带来了 30 多项性能改进以及新的「vector set」(向量集合)数据类型(beta),用于高维向量相似度检索,适用于语义搜索与推荐等 AI 场景;该类型由 Redis 原作者 Salvatore Sanfilippo 开发,设计上受有序集合(sorted set)启发(Redis 8 is now GA)。官方文档说明 vector set 目前处于 beta,API 与行为可能在未来版本中变化(Redis 8.0)。Redis 8 还整合了此前分层的能力,包括支持水平与垂直扩展的 Redis Search、可查询 JSON 文档类型、时序、五种概率型数据结构(Bloom、Cuckoo、Count-min sketch、Top-k、t-digest)(Redis Open Source 8.0 release notes)。

2. Valkey 持续迭代并强调效率与一致性。 Linux Foundation 于 2026 年 5 月 19 日宣布 Valkey 9.1 正式可用(GA),该版本聚焦更高的效率与模块化,以在生产环境中提供更高可靠性与一致性,并包含来自 80 多位贡献者在安全、可观测性、性能、效率与工具方面的改进(Valkey Enhances Efficiency, Security, and Modular Performance with 9.1 Release)。Valkey 9.0 引入了原子 slot 迁移、Hash 字段级过期与集群模式下的多数据库支持,并宣称单集群可达每秒 10 亿次操作;8.1 则带来额外 27% 的内存节省(小键值对约 16 字节时可节省最多 41%)(Valkey Meets Laravel: Bridging Open Source Communities at Laracon India 2026)。官方版本页显示 8.x 系列的最新版本为 8.1.10(发布日期 2026-09-01)(Valkey)。

3. CDN 边缘缓存向分层缓存与更大容量演进。 Cloudflare 的 Cache Reserve 通过长期保存长尾内容来提高缓存命中率并降低回源与出口(egress)成本(Cloudflare Cache Reserve)。其分层缓存(Tiered Caching)机制在本地 PoP 未命中时向上层缓存拓扑查询,Smart Tiered Caching 与 Regional Tiered Cache 通过集中连接提高命中率、降低全局回源负载;Enterprise 客户还可自定义分层拓扑(Designing a distributed web performance architecture)。

4. 多层缓存(Caffeine + Redis)成为主流实践。 Spring Boot 等技术栈的多级缓存方案以 Caffeine 作为进程内 L1(亚微秒读取、无网络)、Redis 作为 L2 回退与一致性层,从而在热数据上获得亚毫秒级读取(Spring Boot Caching: Multi-Level Cache with Caffeine + Redis)。

核心技术与关键概念

代表性项目 / 公司 / 产品(附官方链接)

项目 / 产品定位链接
Redis 8内存数据平台,含 vector set、Search、JSON、时序与概率结构redis.io
ValkeyLinux Foundation 下的开源键值数据库,9.1 已 GAlinuxfoundation.org
Cloudflare Cache Reserve / Tiered CacheCDN 边缘缓存与分层缓存cloudflare.com
CaffeineJVM 进程内高性能缓存库AWS Security Blog
Memcached经典分布式内存缓存Application-Level Caching
Redisson基于 Redis/Valkey 的客户端与失效协调redisson.pro

关键数据与评测结果(附来源)

指标数值来源
Redis 8 性能改进项30+ 项redis.io
Valkey 8.1 额外内存节省27%(小键值对最多 41%)valkey.io
Valkey 9.0 单集群吞吐最多 10 亿次操作/秒valkey.io
Valkey 8.x 最新版本8.1.10(2026-09-01)valkey.io
Cloudflare vs CloudFront 命中率(第三方估算)90–98% vs 85–95%Cloudflare vs AWS 2026

需注意,Cloudflare 与 CloudFront 的命中率对比来自第三方博客,属估算口径,官方文档未给出可直接比较的数字。

趋势与争议

参考来源

  1. Redis 缓存层架构指南(Cache layer architecture guide)
  2. Caching Strategies 2026: Redis, Valkey, CDN, and Application Caching
  3. What is Cache Invalidation?
  4. Two Hard Things: Naming Things & Cache Invalidation — Valkey Edition
  5. DB 앞단 캐싱 전략 — Redis 캐시 레이어와 무효화
  6. Redis 8 is now GA, loaded with new features and more than 30 performance improvements
  7. Announcing vector sets: a new Redis data type for vector similarity
  8. Redis 8.0(What's new)
  9. Redis Open Source 8.0 release notes
  10. Valkey Enhances Efficiency, Security, and Modular Performance with 9.1 Release and New Ecosystem Integrations
  11. Valkey Meets Laravel: Bridging Open Source Communities at Laracon India 2026
  12. Valkey(官方版本页)
  13. Valkey Blog
  14. Cloudflare Cache Reserve
  15. Cloudflare — Cache performance
  16. Designing a distributed web performance architecture
  17. Cloudflare vs AWS 2026: CDN, Security & Pricing Compared
  18. Mastering Advanced Caching: Redis, Caffeine, and Multi-Layer Architectures
  19. Application-Level Caching
  20. Spring Boot Caching: Multi-Level Cache with Caffeine + Redis
  21. Prevent Cache Avalanche with Multi-Level Caffeine + Redis: High-Availability Design
  22. Caching KMS data keys in multi-thread environments
  23. Licenses — Redis
  24. What is Valkey? — Redis
← 后端语言与运行时云原生与 Kubernetes →