Comments (2)
I also ran into this. But after upgrading from 10.2.10 --> @nestjs/[email protected] and @nestjs/[email protected].
In thisprovided repo the tests fail , there is also a working branch.
from cache-manager.
While testing with the following versions:
"@nestjs/cache-manager": "2.2.2",
"@nestjs/common": "^10.3.10",
"@nestjs/core": "^10.3.10"
the issue seems resolved, but a strange bug occurs when CacheModule
is registered with the same configuration. It shares the same cache store even if it is imported by different modules. Here is the reproduction: https://codesandbox.io/p/devbox/nestjs-cache-register-bug-2snp4k?file=%2Fsrc%2Fapp.spec.ts
After investigation, I realized that the useFactory
function provided by CACHE_MANAGER
is only called when the options
parameter is registered differently.
cache-manager/lib/cache.providers.ts
Line 19 in 65d7101
Is there any caching mechanism applied when initializing a dynamic provider here related to ConfigurableModuleBuilder
? If so, I think we can fix this issue by generating a unique ID each time the CacheModule
is registered, like the following:
static register<StoreConfig extends Record<any, any> = Record<string, any>>(
options: CacheModuleOptions<StoreConfig> = {} as any,
): DynamicModule {
return {
global: options.isGlobal,
...super.register({ ...options, id: <UNIQUE_ID> }),
};
}
from cache-manager.
Related Issues (20)
- Using CacheInterceptor on endpoint and returning classes using class-validator decorators and applying @Excluded() decorator is not excluding the attribute in the cached response. HOT 1
- Set with CacheStoreSetOptions doesn't set correct TTL HOT 1
- Existing multicaching support not exposed in types HOT 4
- CacheModule.register() missing type for store property for redisStore HOT 1
- Need detailed Error when set cache key. HOT 3
- Merge injection token for cache and cache instance HOT 7
- Dependency Dashboard
- The register method of CacheModel does not utilize the useClass specified HOT 1
- Dynamic cache key HOT 1
- TypeError: ttl must be a positive integer if specified HOT 1
- Cache prefix HOT 1
- redisInstance is not used HOT 1
- Unable to call cacheManager properly when there is a cyclic dependency HOT 1
- registerAsync + global does not work HOT 3
- enableVersioning HOT 1
- `cache-manager 5.6.0` fails to load HOT 2
- App crashing on redis WRONGPASS error and no way recover from this state HOT 1
- Set `ttl` via `this.cacheManager.set` is not working when `ttl` is set in `CacheModule.registerAsync` as global HOT 1
- Customize CacheKey according to request parameters HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cache-manager.