stipsan / ioredis-mock

Emulates ioredis by performing all operations in-memory.
MIT License
333 stars 125 forks source link

Persist data to disk #1307

Open silverwind opened 1 year ago

silverwind commented 1 year ago

For a CLI application that use ioredis, it would be useful to have a way to persist and restore the current ioredis-mock data, so that multiple invocations of the CLI can work with a shared data set. Hypothetical API:

RedisMock.saveDump("file.json")
RedisMock.restoreDump("file.json")
silverwind commented 1 year ago

I think I'll go another route with the CLI testing and avoid the child processes, which is both faster and ioredis-mock data can persists for the lifetime of the testing process.

Leaving this open as such save/restore functionality may still be useful for other use cases.