2536c937e3
翻译自英文原版 maths-cs-ai-compendium,共 20 章全部完成。 第01章 向量 | 第02章 矩阵 | 第03章 微积分 第04章 统计学 | 第05章 概率论 | 第06章 机器学习 第07章 计算语言学 | 第08章 计算机视觉 | 第09章 音频与语音 第10章 多模态学习 | 第11章 自主系统 | 第12章 图神经网络 第13章 计算与操作系统 | 第14章 数据结构与算法 第15章 生产级软件工程 | 第16章 SIMD与GPU编程 第17章 AI推理 | 第18章 ML系统设计 第19章 应用人工智能 | 第20章 前沿人工智能 翻译说明: - 所有数学公式 $...$ / $$...$$、代码块、图片引用完整保留 - mkdocs.yml 配置中文导航 + language: zh - README.md 已翻译为中文(兼 docs/index.md) - docs/ 目录包含指向各章文件的 symlink - 约 29,000 行中文内容,排除 .cache/ 构建缓存
41 lines
2.9 KiB
XML
41 lines
2.9 KiB
XML
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 650 250" width="650" height="250">
|
|
<defs>
|
|
<marker id="ca-arr" markerWidth="8" markerHeight="6" refX="8" refY="3" orient="auto">
|
|
<path d="M0,0 L8,3 L0,6 Z" fill="#666"/>
|
|
</marker>
|
|
</defs>
|
|
<text x="325" y="22" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#333">Cache-Aside Pattern</text>
|
|
|
|
<!-- App -->
|
|
<rect x="250" y="55" width="100" height="50" rx="10" fill="#3498db" fill-opacity="0.12" stroke="#3498db" stroke-width="2"/>
|
|
<text x="300" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#3498db">Application</text>
|
|
|
|
<!-- Cache -->
|
|
<rect x="50" y="150" width="110" height="50" rx="10" fill="#f39c12" fill-opacity="0.12" stroke="#f39c12" stroke-width="2"/>
|
|
<text x="105" y="180" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#f39c12">Cache (Redis)</text>
|
|
|
|
<!-- Database -->
|
|
<rect x="440" y="150" width="110" height="50" rx="10" fill="#27ae60" fill-opacity="0.12" stroke="#27ae60" stroke-width="2"/>
|
|
<text x="495" y="180" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" font-weight="bold" fill="#27ae60">Database</text>
|
|
|
|
<!-- Step 1: check cache -->
|
|
<line x1="260" y1="100" x2="140" y2="150" stroke="#f39c12" stroke-width="1.5" marker-end="url(#ca-arr)"/>
|
|
<text x="170" y="118" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" font-weight="bold" fill="#f39c12">1. Check cache</text>
|
|
|
|
<!-- Step 2: cache miss → query DB -->
|
|
<line x1="340" y1="100" x2="460" y2="150" stroke="#27ae60" stroke-width="1.5" marker-end="url(#ca-arr)"/>
|
|
<text x="430" y="118" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" font-weight="bold" fill="#27ae60">2. Miss → query DB</text>
|
|
|
|
<!-- Step 3: store in cache -->
|
|
<line x1="440" y1="180" x2="168" y2="180" stroke="#9b59b6" stroke-width="1.5" marker-end="url(#ca-arr)" stroke-dasharray="5,3"/>
|
|
<text x="300" y="200" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" font-weight="bold" fill="#9b59b6">3. Store result in cache for next time</text>
|
|
|
|
<!-- Cache hit path -->
|
|
<rect x="30" y="70" width="70" height="25" rx="5" fill="#27ae60" fill-opacity="0.15" stroke="#27ae60" stroke-width="1"/>
|
|
<text x="65" y="87" text-anchor="middle" font-family="Arial, sans-serif" font-size="8" font-weight="bold" fill="#27ae60">HIT: ~1ms</text>
|
|
|
|
<rect x="520" y="70" width="80" height="25" rx="5" fill="#e74c3c" fill-opacity="0.15" stroke="#e74c3c" stroke-width="1"/>
|
|
<text x="560" y="87" text-anchor="middle" font-family="Arial, sans-serif" font-size="8" font-weight="bold" fill="#e74c3c">MISS: ~50ms</text>
|
|
|
|
<text x="325" y="240" text-anchor="middle" font-family="Arial, sans-serif" font-size="9" fill="#666">Subsequent requests for the same data hit the cache (1ms) instead of the database (50ms)</text>
|
|
</svg> |