Is it possible to cache specific entity ?
Issue type:
[*] question [ ] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[*] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] sqlite
[ ] sqljs
[ ] websql
TypeORM version:
[*] latest
[ ] @next
[ ] 0.x.x (or put your version here)
Steps to reproduce or a small repository showing the problem:
reading this doc: https://github.com/typeorm/typeorm/blob/master/docs/caching.md
i understand that you can cache a query via { cache: true } and globally cache via the options
{
type: "mysql",
host: "localhost",
username: "test",
...
cache: {
duration: 30000 // 30 seconds
}
}
but is it possible to cache globally a specific entity? for example, i have customer_statuses entity which i wanna cache all the time in all the queries without manually putting { cache: true }, is such a think possible?
you can cache per-select using cache flag inside find options or using .cache method of QueryBuilder.
Let me know if you still have questions.
Can Typeorm cache entity when get from database and store till other query call that Entity