cache

package
v1.1.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCacheMiss = errors.New("cache: key is missing")

Functions

func AddCacheFlagsToCmd

func AddCacheFlagsToCmd(cmd *cobra.Command) func() (*Cache, error)

AddCacheFlagsToCmd adds flags which control caching to the specified command

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache provides strongly types methods to store and retrieve values from shared cache

func NewCache

func NewCache(cacheClient CacheClient) *Cache

NewCache creates new instance of Cache

func (*Cache) GetAppDetails

func (c *Cache) GetAppDetails(commitSHA, path string, valueFiles []string, res interface{}) error

func (*Cache) GetAppManagedResources

func (c *Cache) GetAppManagedResources(appName string) ([]*appv1.ResourceDiff, error)

func (*Cache) GetAppResourcesTree

func (c *Cache) GetAppResourcesTree(appName string) (*appv1.ApplicationTree, error)

func (*Cache) GetClusterConnectionState

func (c *Cache) GetClusterConnectionState(server string) (appv1.ConnectionState, error)

func (*Cache) GetGitFile

func (c *Cache) GetGitFile(commitSha string, path string) ([]byte, error)

func (*Cache) GetGitListDir

func (c *Cache) GetGitListDir(commitSha string, path string) ([]string, error)

func (*Cache) GetManifests

func (c *Cache) GetManifests(commitSHA string, appSrc *appv1.ApplicationSource, namespace string, appLabelKey string, appLabelValue string, res interface{}) error

func (*Cache) GetOIDCState

func (c *Cache) GetOIDCState(key string) (*OIDCState, error)

func (*Cache) GetRepoConnectionState

func (c *Cache) GetRepoConnectionState(repo string) (appv1.ConnectionState, error)

func (*Cache) SetAppDetails

func (c *Cache) SetAppDetails(commitSHA, path string, valueFiles []string, res interface{}) error

func (*Cache) SetAppManagedResources

func (c *Cache) SetAppManagedResources(appName string, managedResources []*appv1.ResourceDiff) error

func (*Cache) SetAppResourcesTree

func (c *Cache) SetAppResourcesTree(appName string, resourcesTree *appv1.ApplicationTree) error

func (*Cache) SetClusterConnectionState

func (c *Cache) SetClusterConnectionState(server string, state *appv1.ConnectionState) error

func (*Cache) SetGitFile

func (c *Cache) SetGitFile(commitSha string, path string, data []byte) error

func (*Cache) SetListDir

func (c *Cache) SetListDir(commitSha string, path string, files []string) error

func (*Cache) SetManifests

func (c *Cache) SetManifests(commitSHA string, appSrc *appv1.ApplicationSource, namespace string, appLabelKey string, appLabelValue string, res interface{}) error

func (*Cache) SetOIDCState

func (c *Cache) SetOIDCState(key string, state *OIDCState) error

func (*Cache) SetRepoConnectionState

func (c *Cache) SetRepoConnectionState(repo string, state *appv1.ConnectionState) error

type CacheClient

type CacheClient interface {
	Set(item *Item) error
	Get(key string, obj interface{}) error
	Delete(key string) error
}

func NewRedisCache

func NewRedisCache(client *redis.Client, expiration time.Duration) CacheClient

type InMemoryCache

type InMemoryCache struct {
	// contains filtered or unexported fields
}

func NewInMemoryCache

func NewInMemoryCache(expiration time.Duration) *InMemoryCache

func (*InMemoryCache) Delete

func (i *InMemoryCache) Delete(key string) error

func (*InMemoryCache) Flush

func (i *InMemoryCache) Flush()

func (*InMemoryCache) Get

func (i *InMemoryCache) Get(key string, obj interface{}) error

func (*InMemoryCache) Set

func (i *InMemoryCache) Set(item *Item) error

type Item

type Item struct {
	Key    string
	Object interface{}
	// Expiration is the cache expiration time.
	Expiration time.Duration
}

type OIDCState

type OIDCState struct {
	// ReturnURL is the URL in which to redirect a user back to after completing an OAuth2 login
	ReturnURL string `json:"returnURL"`
}

Jump to

Keyboard shortcuts

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