Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ETag sample code and Blog #929

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

hamdaankhalid
Copy link
Contributor

@hamdaankhalid hamdaankhalid commented Jan 19, 2025

Blog and Sample Code as reference implementation of OCC and Cache invalidation scenario

If you're looking to:

1. **Reduce network bandwidth utilization for caching.**
2. **Avoid the cost of transactions when working with non-atomic values in your cache store.**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, we can add the case of maintaining a consistent cache with a backend database that also supports ETags.

@@ -0,0 +1,181 @@
---
slug: etags-when-and-how
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good idea to link to the blog post from the documentation page for etags.

Comment on lines +38 to +57
#### High-Level Diagram
```
(server 1)----[server 1 reads from cache]----(cache)
|
|
[server 2 writes to the cache, invalidating whatever server 1 had read]
|
|
(server 2)
```

#### Sequence Diagram
```
server 1 cache server 2
1. initial read from cache for k1----------------------->
2. <----------------------------------------Send Data and ETag
<-------------------------update value for k1 (invalidates k1)
3. second read to cache for k1 ------------------------->
<--------------------------------------(What is sent back?)
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these diagrams be done with Mermaid? Docusaurus seems to support it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, we're already using mermaid in the website. For example: https://microsoft.github.io/garnet/docs/dev/configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants