package api import ( "fmt" "net/http" "git.dev-null.rocks/alexohneander/distributed-cache/pkg/cache" "github.com/labstack/echo/v4" ) func GetItem(cache *cache.Cache) echo.HandlerFunc { return func(c echo.Context) error { cachedObj, found := cache.Get("key") resp := "" if found { resp = fmt.Sprintf("%+v", cachedObj) } return c.String(http.StatusOK, resp) } } func PostItem(cache *cache.Cache) echo.HandlerFunc { return func(c echo.Context) error { cache.Set("key", "value") return c.String(http.StatusCreated, "") } }