I am working with fiber golang framework. I can't figure out why I cannot get the value set in the store(Redis in this case) from another request or within. Below is the code:
sessionProvider := redis.New(redis.Config{
KeyPrefix: "session",
Addr: "127.0.0.1:6379",
PoolSize: 8,
IdleTimeout: 30 * time.Second,
})
sessions := session.New(session.Config{
Provider: sessionProvider,
})
// sample routes for testing session
app.Get("/testing1", func(c *fiber.Ctx) {
store := sessions.Get(c)
// set value to the session store
store.Set("name", "King Windrol")
store.Save()
})
app.Get("/testing2", func(c *fiber.Ctx) {
store := sessions.Get(c)
c.Send(store.Get("name"))
})
I've tried to get it from within the same request, it seems to work just before calling store.Save()
but not working after! it just returns nil