cache

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSession

func GetSession(k keyring.Keyring) (kion.Session, bool, error)

GetSession is a common func for all Cache implementations and retrieves a Session in the cache.

func SetSession

func SetSession(k keyring.Keyring, session kion.Session) error

SetSession is a common func for all Cache implementations and stores a Session in the cache.

Types

type Cache

type Cache interface {
	SetStak(key string, value kion.STAK) error
	GetStak(key string) (kion.STAK, bool, error)
	SetSession(value kion.Session) error
	GetSession() (kion.Session, bool, error)
}

Cache is an interface for storing and receiving data.

type CacheData

type CacheData struct {
	STAK    map[string]kion.STAK
	SESSION kion.Session
}

CacheData is a nested structure for storing kion-cli data.

type NullCache

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

NullCache implements the Cache interface and does nothing.

func NewNullCache

func NewNullCache(keyring keyring.Keyring) *NullCache

NewNullCache creates a new NullCache.

func (*NullCache) GetSession

func (c *NullCache) GetSession() (kion.Session, bool, error)

GetSession implements the Cache interface for NullCache and wraps a common function for retrieving session data.

func (*NullCache) GetStak

func (c *NullCache) GetStak(key string) (kion.STAK, bool, error)

GetStak returns an empty STAK, false, and a nil error.

func (*NullCache) SetSession

func (c *NullCache) SetSession(session kion.Session) error

SetSession implements the Cache interface for NullCache and wraps a common function for storing session data.

func (*NullCache) SetStak

func (c *NullCache) SetStak(key string, value kion.STAK) error

SetStak does nothing.

type RealCache

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

RealCache is our cache object for passing the keychain to receiver methods.

func NewCache

func NewCache(keyring keyring.Keyring) *RealCache

NewCache creates a new RealCache.

func (*RealCache) GetSession

func (c *RealCache) GetSession() (kion.Session, bool, error)

GetSession implements the Cache interface for RealCache and wraps a common function for retrieving session data.

func (*RealCache) GetStak

func (c *RealCache) GetStak(key string) (kion.STAK, bool, error)

GetStak retrieves a STAK from the cache.

func (*RealCache) SetSession

func (c *RealCache) SetSession(session kion.Session) error

SetSession implements the Cache interface for RealCache and wraps a common function for storing session data.

func (*RealCache) SetStak

func (c *RealCache) SetStak(key string, value kion.STAK) error

SetStak stores a STAK in the cache.

Jump to

Keyboard shortcuts

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