package cache import ( "electricity_bill_calc/model" "fmt" "time" ) func CacheSession(session *model.Session) error { key := fmt.Sprintf("session:%s", session.Token) return Cache(key, session, 2*time.Hour) } func RetreiveSession(token string) (*model.Session, error) { key := fmt.Sprintf("session:%s", token) return Retreive[model.Session](key) } func HasSession(token string) (bool, error) { key := fmt.Sprintf("session:%s", token) return Exists(key) } func ClearSession(token string) (bool, error) { key := fmt.Sprintf("session:%s", token) return Delete(key) }