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

I've encountered some issues while using it. Can you help me? #380

Open
DarkiT opened this issue Jul 26, 2024 · 3 comments
Open

I've encountered some issues while using it. Can you help me? #380

DarkiT opened this issue Jul 26, 2024 · 3 comments

Comments

@DarkiT
Copy link

DarkiT commented Jul 26, 2024

Hello, my friend. Thank you for providing such an excellent extension library, but I've encountered some issues while using it. Can you help me?

I have some not-so-important data to store, but I don't want to add an additional RedisServer, so I used the library you developed. It works great most of the time, but I encountered a problem when I stopped the service and tried to export the data. For example, the code s.Dump() below doesn't have any data.

func main() {
    ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
    defer stop()

    s := miniredis.NewMiniRedis()
    s.DB(16)
    if err := s.StartAddr(":6379"); err != nil {
        return
    }
    slog.Info(s.Addr())

    <-ctx.Done()
    slog.Info("export", slog.String("db", s.Dump()))
    s.Close()
    slog.Info("stop server")
}

Based on the above requirements, I hope there is an import and export to file feature so that the data stored in the last session can be automatically restored when the service stops and resumes. It would be best if the exported files could be compressed to save hard drive space. Do you have any plans to add this feature?

@alicebob
Copy link
Owner

miniredis really isn't meant for anything real, it's really only for helping in tests. If you want Redis I recommend installing a real Redis, not this.

@DarkiT
Copy link
Author

DarkiT commented Jul 26, 2024

miniredis really isn't meant for anything real, it's really only for helping in tests. If you want Redis I recommend installing a real Redis, not this.

However, I must say it works very stably and has done an excellent job completing my tasks. For me, it has replaced a real RedisServer in my scenario.

@alicebob
Copy link
Owner

Okay, but adding proper export/import is still out of scope, unfortunately.

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