Answer the question
In order to leave comments, you need to log in
How to display data?
Hello, I can not figure out how to display data from redis.
I have a form:
after I filled in the fields, the form is sent, it processes and passes the data to the radish, this is the output:
This is how I generate the id:
func setNews(title, url, desc, t string) {
id, err := client.Get("news:id").Result()
if err != nil {
client.Set("news:id", "0", 0)
}
client.Incr("news:id")
client.HMSet("news:"+id, "id", id, "title", title, "url", url, "desc", desc, "time", t)
client.Close()
}
Answer the question
In order to leave comments, you need to log in
You need to make another news index in which to store all the keys to select from the radish (slice []string
).
Also, every n minutes, clone this slice into a radish, and then, when restarting, read it from there
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question