I've got a struct like below:
type Page struct {
title string
url string
}
and a map of structs:
var mostViewed = make(map[int]Page)
With go-cache, I store the map with a TTL time.
c.Set("data", mostViewed, 60*time.Minute)
But, once I recover "data" key, how could I assing it back to a map?
a, _ := c.Get("data")
fmt.Printf("%+v
", a)
out: map[17:{title:xxx, url:yyy}]
I tried something like:
z := map[int]Page{a}
Any clue? It's like "remapping" a mapped string.