-
Notifications
You must be signed in to change notification settings - Fork 59
Description
v3.0.0 introduced a breaking change where instead of the module exporting a default:
const methods = {
create: (...args) => redisStore(...args),
};
export default methods;
such that the store can be instantiated with the factory method like:
var redisStore = require('cache-manager-redis-store');
var config = {
host: 'localhost', // default value
port: 6379, // default value
};
var redisCache = cacheManager.caching({
store: redisStore,
...config,
});it can no longer be instantiated this way and must now be instantiated before passing it to "cache-manager" (see current README usage).
However, the implementation of this module clearly expects to receive args from the cache-manager when instantiating (e.g. isCacheableValue here). These are args that are not part of the input to the rediStore fn in the typings from this module (nor in the DefinitelyTyped types), but rather that are meant to be passed to the caching fn of cache-manager which will then pass it in to the factory method as seen in its source here (note that this is the older v4.0.1, which is the latest that is compatible with the latest v3.0.1 of this package).
I am guessing the usage of the factory method was removed, even though if it is clearly how cache-manager expects to integrate with stores, because instantiating the Redis store became an async process as another one of the breaking changes in 3.0.0.
Why is the isCacheableValue and other args still referenced when instantiating the store if they are not expected to be passed in from caching fn?
How are we even supposed to pass these args in then? Directly when instantiating the store (should the types then be updated?)
In general, should "cache-manager" caching function be made to handle async factory methods so that prior usage can be reverted?