func myCacheReadHandler(ctx *macaron.Context, c cache.Cache) interface{} { val := c.Get(ctx.Params(":key")) if val != nil { return val } else { return fmt.Sprintf("no cache with \"%s\" set", ctx.Params(":key")) } }
func myCacheWriteHandler(ctx *macaron.Context, c cache.Cache) string { c.Put(ctx.Params(":key"), ctx.Params(":value"), 300) return "cached for 5 minutes" }