Leaving that for example database systems have their own cache system like for example TypeORM https://typeorm.io/#/caching, I think you should add some cache system with their own decorators.
Example: https://github.com/kwhitley/apicache
Cache types/strategies: https://scotch.io/tutorials/how-to-optimize-node-requests-with-simple-caching-strategies#toc-results-and-recommendation
Hello @chiqui3d,
You can implement your own decorator to cache request and choose your prefered lib to doing that.
Example with apicache:
import apicache from 'apicache'
let cache = apicache.middleware
@Controller('/')
class MyController {
@Get()
@UseBefore(cache('5 minutes'))
getSomething(){
}
}
You can implement your own decorator like that:
import apicache from 'apicache'
const cache = apicache.middleware
export function Cache(option: string) {
return UseBefore(cache(options))
}
And use it on controller or method:
@Controller('/')
@Cache('5 minutes')// here
class MyController {
@Get()
@Cache('5 minutes') // or here
getSomething(){
}
}
I think theses examples will help you!
If you want develop an official package for Tsed and provide a Cache strategy, you 're welcom :)
See you
Romain
Most helpful comment
Hello @chiqui3d,
You can implement your own decorator to cache request and choose your prefered lib to doing that.
Example with apicache:
You can implement your own decorator like that:
And use it on controller or method:
I think theses examples will help you!
If you want develop an official package for Tsed and provide a Cache strategy, you 're welcom :)
See you
Romain