Skip to content

Commit

Permalink
feat(data-security): Add Unkey Semantic Cache section
Browse files Browse the repository at this point in the history
This commit introduces a new section on Unkey Semantic Cache in the data security chapter. It explains the limitations of traditional query-based caching and demonstrates how semantic caching can improve cache hit rates by focusing on the intent behind queries, rather than exact phrasing. This addition enhances the understanding of advanced caching strategies for data security.
  • Loading branch information
phodal committed Sep 2, 2024
1 parent 44c482f commit c840529
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/agent-data-security.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,23 @@ remote:

## 示例

### Unkey Semantic cache

[Code](https://github.com/unkeyed/unkey/tree/main/apps/semantic-cache)

[https://www.unkey.com/blog/semantic-caching](https://www.unkey.com/blog/semantic-caching)

一个简单的缓存解决方案是使用用户查询作为键,将工作流的结果作为值进行缓存。 这可以实现对相同查询的响应进行重复使用。但这依赖于用户查询的措辞完全相同。

例如,如果两个用户都问“如何取消我的订阅”,那么第二个用户会收到缓存的响应。但如果另一个用户问的是“我需要取消我的订阅 - 怎么做?”,那么我们将遇到缓存未命中的情况。
虽然这两个问题的意图是相同的,但措辞不同。

这正是语义缓存可以发挥作用的地方:通过基于查询嵌入的缓存,我们可以确保所有提出相同问题的用户都能命中缓存。以下图表概述了这种架构:

![unkey-cachehit.webp](images/unkey-cachehit.webp)

![unkey-cachemiss.webp](images/unkey-cachemiss.webp)

### Microsoft [Presidio](https://microsoft.github.io/presidio/)

Presidio(源自拉丁语praesidium ‘保护、卫戍’)致力于确保敏感数据得到妥善管理和治理。该系统为私人实体提供快速识别和匿名化功能,
Expand Down
1 change: 1 addition & 0 deletions src/aise-code-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ pr_review:
#### Style Guide
```yaml
version: 1.3
pr_review:
Expand Down
Binary file added src/images/unkey-cachehit.webp
Binary file not shown.
Binary file added src/images/unkey-cachemiss.webp
Binary file not shown.

0 comments on commit c840529

Please sign in to comment.