Skip to content

Commit 4466f39

Browse files
committed
Update README.
1 parent 7dbefee commit 4466f39

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
## Features
3030
* 🌐 **Redis Caching:** Centralizes your caching to scale across different systems.
3131
* 🖥️ **Memory Caching:** Simplifies caching when scale is not a concern.
32+
* 🛟 **Type-safe:** The caching options appear in the intellisense for all read queries.
3233

3334
## Requirements
3435

@@ -74,11 +75,11 @@ async function getPostsPublishedByUser(userId: string) {
7475
const publishedPosts = await client.post.findMany({
7576
where: {
7677
published: true,
77-
authorId: 1,
78+
authorId: userId,
7879
},
7980

81+
// All of these are optional.
8082
cache: {
81-
// All of these are optional.
8283
ttl: 60,
8384
swr: 120,
8485
tags: [`user:${userId}`],
@@ -128,9 +129,7 @@ const revalidatedPublishedPosts = await client.$cache.revalidation as Post[]
128129
* `swr` reduces response times by serving cached results, but does not reduce database load because it performs a revalidation in the background after each request.
129130

130131
> [!NOTE]
131-
> The total TTL of a cache entry is equal to its `ttl` + `swr`. The `ttl` window comes first, followed by the `swr` window.
132-
133-
You can combine the two options to best suit the needs of your application.
132+
> The total TTL of a cache entry is equal to its `ttl` + `swr`. The `ttl` window comes first, followed by the `swr` window. You can combine the two options to best suit the needs of your application.
134133
135134
## License
136135

0 commit comments

Comments
 (0)