Skip to content

Commit cbb726f

Browse files
committed
docs(cache-manager): support @CacheTTL at the controller level
1 parent 18258e7 commit cbb726f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

content/techniques/caching.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,11 @@ CacheModule.register({
147147

148148
While global cache is enabled, cache entries are stored under a `CacheKey` that is auto-generated based on the route path. You may override certain cache settings (`@CacheKey()` and `@CacheTTL()`) on a per-method basis, allowing customized caching strategies for individual controller methods. This may be most relevant while using [different cache stores.](https://docs.nestjs.com/techniques/caching#different-stores)
149149

150+
You can apply the `@CacheTTL()` decorator on a per-controller basis to set a caching TTL for the entire controller. In situations where both controller-level and method-level cache TTL settings are defined, the cache TTL settings specified at the method level will take priority over the ones set at the controller level.
151+
150152
```typescript
151153
@Controller()
154+
@CacheTTL(50)
152155
export class AppController {
153156
@CacheKey('custom_key')
154157
@CacheTTL(20)

0 commit comments

Comments
 (0)