Raja
Raja

Reputation: 87

nestjs cache manager with ttl is not overridden with the controller based ttl

I'm using this nestjs cachemanager to cache the APIs, the issue that face is,

app module:

@Module({
imports: [
CacheModule.register({isGlobal:true})
]})

myowncontroller.ts
@Get()
async getAppConfig() {
await this.cacheManager.set('config', 'value...', 20);
}

So here I'm expecting this Get call to cache the value for 20 seconds, but the cache is getting cleared in default time of 5 seconds

Upvotes: 0

Views: 1095

Answers (1)

Raja
Raja

Reputation: 87

after surfing many articles, I found the issue is on the cache-manager version, I've used 4.0.0 which I upgraded to 4.1.0(most used) and this solved the problem.

I hope this helps someone in the future. :-)

Upvotes: 0

Related Questions