Skip to content

Commit 321efd6

Browse files
committed
docs(caching): update get cache method description
1 parent 5a06e1e commit 321efd6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/techniques/caching.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ constructor(@Inject(CACHE_MANAGER) private cacheManager: Cache) {}
3838

3939
> info **Hint** The `Cache` class is imported from the `cache-manager`, while `CACHE_MANAGER` token from the `@nestjs/common` package.
4040
41-
The `get` method on the `Cache` instance (from the `cache-manager` package) is used to retrieve items from the cache. If the item does not exist in the cache, an exception will be thrown.
41+
The `get` method on the `Cache` instance (from the `cache-manager` package) is used to retrieve items from the cache. If the item does not exist in the cache, undefined will be returned.
4242

4343
```typescript
44-
const value = this.cacheManager.get('key');
44+
const value = await this.cacheManager.get('key');
4545
```
4646

4747
To add an item to the cache, use the `set` method:

0 commit comments

Comments
 (0)