redis-semaphore
redis-semaphore copied to clipboard
Support for ioredis-mock
Hi,
I have a case in which I need to pass an ioredis-mock instance for testing but I get the following error:
"client" must be instance of ioredis client or cluster
Is there a solution or workaround for this case?
Thanks!
I had similar questions too. Is it really necessary to require a strict ioredis instance?
In my case I wanted to pass a duck-type compatible client, backed by redis-over-http client
If maintainers thinks it's fine I'm happy to do something. I personally wanted a mutex that work with Upstash serverless redis.
The idea on my head is, to extract a ioredis-like interface and rely on the interface instead of instanceof check. Since only a few Redis APIs are required, I imagine the interface to be small. Other redis clients, even if they happen to name APIs differently, can be used with an adapter.
@jokester Hi! PR is welcome
Support for ioredis-mock added in v5.6.0