-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Closed
Labels
Description
Issue description
Caching always enabled not caching queries
Expected Behavior
"If set to true then queries (using find methods and QueryBuilder's methods) will always be cached"
With alwaysEnabled: true, it should always cache requests if the cache in the query request is not false
Actual Behavior
When using a request where cache is not specified, the request is not cached.
Steps to reproduce
options:
cache: {
duration: 3000,
alwaysEnabled: true,
provider() {
return new MyCustomCache()
}
},
query:
this.userRepository.find();
My Environment
| Dependency | Version |
|---|---|
| Operating System | |
| Node.js version | latest |
| Typescript version | latest |
| TypeORM version | latest |
Additional Context
https://github.com/typeorm/typeorm/blob/d184d8598c057ce8fa54815e669b567238f3a86e/src/query-builder/SelectQueryBuilder.ts#L3755x should be (cacheOptions.alwaysEnabled && this.expressionMap.cache !== false) ?
Relevant Database Driver(s)
- aurora-mysql
- aurora-postgres
- better-sqlite3
- cockroachdb
- cordova
- expo
- mongodb
- mysql
- nativescript
- oracle
- postgres
- react-native
- sap
- spanner
- sqlite
- sqlite-abstract
- sqljs
- sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, but I don't know how to start. I would need guidance.