Skip to content

Commit 7fbb571

Browse files
authored
Update Disable Cache Expiration Docs
The documentation says to set the `ttl` to `null` should disable the cache. The TS types do not allow it to be null, and I found that actually setting it to null does not disable the cache expiration. It looks like setting the ttl to `0` is actually the way to disable the expiration, at least for the memory store and some other stores. jaredwray/cacheable#107 jaredwray/cacheable#147
1 parent 2f4ee6e commit 7fbb571

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
@@ -58,10 +58,10 @@ You can manually specify a TTL (expiration time) for this specific key, as follo
5858
await this.cacheManager.set('key', 'value', { ttl: 1000 });
5959
```
6060

61-
To disable expiration of the cache, set the `ttl` configuration property to `null`:
61+
To disable expiration of the cache, set the `ttl` configuration property to `0`:
6262

6363
```typescript
64-
await this.cacheManager.set('key', 'value', { ttl: null });
64+
await this.cacheManager.set('key', 'value', { ttl: 0 });
6565
```
6666

6767
To remove an item from the cache, use the `del` method:

0 commit comments

Comments
 (0)