func GetPerm(c context.Context, user *model.User, owner, name string) (*model.Perm, error) {
	key := fmt.Sprintf("perms:%s:%s/%s",
		user.Login,
		owner,
		name,
	)
	val, err := FromContext(c).Get(key)
	if err == nil {
		return val.(*model.Perm), nil
	}
	perm, err := remote.GetPerm(c, user, owner, name)
	if err != nil {
		return nil, err
	}
	FromContext(c).Set(key, perm)
	return perm, nil
}
GetPerm returns the user permissions repositories from the cache
associated with the current repository.
package cache
import (
	"fmt"
	"golang.org/x/net/context"
	"github.com/lgtmco/lgtm/model"
	"github.com/lgtmco/lgtm/remote"
)
func GetRepos(c context.Context, user *model.User) ([]*model.Repo, error) {
	key := fmt.Sprintf("repos:%s",
		user.Login,
	)
	val, err := FromContext(c).Get(key)
	if err == nil {
		return val.([]*model.Repo), nil
	}
	repos, err := remote.GetRepos(c, user)
	if err != nil {
		return nil, err
	}
	FromContext(c).Set(key, repos)
	return repos, nil
}
func GetTeams(c context.Context, user *model.User) ([]*model.Team, error) {
	key := fmt.Sprintf("teams:%s",
		user.Login,
	)
	val, err := FromContext(c).Get(key)
	if err == nil {
		return val.([]*model.Team), nil
	}
	teams, err := remote.GetTeams(c, user)
	if err != nil {
		return nil, err
	}
	FromContext(c).Set(key, teams)
	return teams, nil
}