Skip to content

Commit 7bd8e6d

Browse files
committed
Doc
1 parent c1f4e07 commit 7bd8e6d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@ import mongoose from 'mongoose'
8181
import cache from 'ts-cache-mongoose'
8282

8383
// In-memory example
84-
cache.init(mongoose, {
84+
const instance = cache.init(mongoose, {
8585
defaultTTL: '60 seconds',
8686
engine: 'memory',
8787
})
8888

8989
// OR
9090

9191
// Redis example
92-
cache.init(mongoose, {
92+
const instance = cache.init(mongoose, {
9393
defaultTTL: '60 seconds',
9494
engine: 'redis',
9595
engineOptions: {
@@ -134,11 +134,11 @@ const books = await Book.aggregate([
134134
// Cache invalidation
135135

136136
// To clear all cache, don't use in production unless you know what you are doing
137-
await cache.clear()
137+
await instance.clear()
138138

139139
// Instead use custom cache key
140140
const user = await User.findById('61bb4d6a1786e5123d7f4cf1').cache('1 minute', 'some-custom-key').exec()
141-
await cache.clear('some-custom-key')
141+
await instance.clear('some-custom-key')
142142
```
143143

144144
## Check my other projects

0 commit comments

Comments
 (0)