cache

package
v2.1.1-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteFromUserCache

func DeleteFromUserCache(ctx context.Context, file string) error

func DeleteIngressesFromUserCache

func DeleteIngressesFromUserCache(ctx context.Context) error

DeleteIngressesFromUserCache removes the ingresses cache if exists or returns an error. An attempt to remove a non existing cache is a no-op and the function returns nil.

func DeleteTokenFromUserCache

func DeleteTokenFromUserCache(ctx context.Context) error

DeleteTokenFromUserCache removes token cache if existing or returns an error

func DeleteUserInfoFromUserCache

func DeleteUserInfoFromUserCache(ctx context.Context) error

DeleteUserInfoFromUserCache removes user info cache if existing or returns an error. An attempt to remove a non existing cache is a no-op and the function returns nil.

func LoadFromUserCache

func LoadFromUserCache(ctx context.Context, dest interface{}, file string) error

func LoadIngressesFromUserCache

func LoadIngressesFromUserCache(ctx context.Context) (map[string]*manager.IngressInfo, error)

LoadIngressesFromUserCache gets the ingresses from cache. An empty map is returned if the file does not exist. An error is returned if something goes wrong while loading or unmarshalling.

func LoadTokenFromUserCache

func LoadTokenFromUserCache(ctx context.Context) (*oauth2.Token, error)

LoadTokenFromUserCache gets the token instance from cache or returns an error if something goes wrong while loading or unmarshalling.

func SaveIngressesToUserCache

func SaveIngressesToUserCache(ctx context.Context, ingresses map[string]*manager.IngressInfo) error

SaveIngressesToUserCache saves the provided ingresses to user cache and returns an error if something goes wrong while marshalling or persisting.

func SaveToUserCache

func SaveToUserCache(ctx context.Context, object interface{}, file string) error

func SaveTokenToUserCache

func SaveTokenToUserCache(ctx context.Context, token *oauth2.Token) error

SaveTokenToUserCache saves the provided token to user cache and returns an error if something goes wrong while marshalling or persisting.

func SaveUserInfoToUserCache

func SaveUserInfoToUserCache(ctx context.Context, userInfo *UserInfo) error

SaveUserInfoToUserCache saves the provided user info to user cache and returns an error if something goes wrong while marshalling or persisting.

Types

type UserInfo

type UserInfo struct {
	Id               string `json:"id"`
	Name             string `json:"name"`
	AvatarUrl        string `json:"avatarUrl"`
	AccountId        string `json:"accountId"`
	AccountName      string `json:"accountName"`
	AccountAvatarUrl string `json:"accountAvatarUrl"`
}

func LoadUserInfoFromUserCache

func LoadUserInfoFromUserCache(ctx context.Context) (*UserInfo, error)

LoadUserInfoFromUserCache gets the user info from cache or returns an error if something goes wrong while loading or unmarshalling.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL