Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the expected usage such that the redisStore constructor receives the args from call to caching #61

Open
loucadufault opened this issue Aug 24, 2023 · 1 comment

Comments

@loucadufault
Copy link

loucadufault commented Aug 24, 2023

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?

@rvitaliy
Copy link

Hi!
This repository seams abandoned.

We switched to:
node-cache-manager-redis-yet

You also can evaluate:
node-cache-manager-ioredis-yet as alternative with ioredis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants