cache

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package cache provides caching functionality for kion-cli using a keyring.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	SetStak(carName string, accNum string, accAlias string, value kion.STAK) error
	GetStak(carName string, accNum string, accAlias string) (kion.STAK, bool, error)
	SetSession(value kion.Session) error
	GetSession() (kion.Session, bool, error)
	SetPassword(host string, idmsID uint, un string, pw string) error
	GetPassword(host string, idmsID uint, un string) (string, bool, error)
	FlushCache() error
}

Cache is an interface for storing and receiving data.

type CacheData

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

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

type NullCache

type NullCache struct {
}

NullCache implements the Cache interface and does nothing.

func NewNullCache

func NewNullCache() *NullCache

NewNullCache creates a new NullCache.

func (*NullCache) FlushCache added in v0.3.0

func (c *NullCache) FlushCache() error

FLushCache implements the FlushCache interface for NullCache. This is just to satisfy the interface and should never be called.

func (*NullCache) GetPassword added in v0.7.0

func (c *NullCache) GetPassword(host string, idmsID uint, un string) (string, bool, error)

GetPassword returns an empty password, false, and a nil error.

func (*NullCache) GetSession

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

GetSession implements the Cache interface for NullCache and returns an empty session, false, and a nil error.

func (*NullCache) GetStak

func (c *NullCache) GetStak(carName string, accNum string, accAlias string) (kion.STAK, bool, error)

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

func (*NullCache) SetPassword added in v0.7.0

func (c *NullCache) SetPassword(host string, idmsID uint, un string, pw string) error

SetPassword does nothing.

func (*NullCache) SetSession

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

SetSession implements the Cache interface for NullCache and does nothing.

func (*NullCache) SetStak

func (c *NullCache) SetStak(carName string, accNum string, accAlias 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) FlushCache added in v0.3.0

func (c *RealCache) FlushCache() error

FLushCache implements the FlushCache interface for RealCache.

func (*RealCache) GetPassword added in v0.7.0

func (c *RealCache) GetPassword(host string, idmsID uint, un string) (string, bool, error)

GetPassword retrieves a password from the cache.

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(carName string, accNum string, accAlias string) (kion.STAK, bool, error)

GetStak retrieves a STAK from the cache.

func (*RealCache) SetPassword added in v0.7.0

func (c *RealCache) SetPassword(host string, idmsID uint, un string, pw string) error

SetPassword stores a Password in the cache (or removes it if the password is nil).

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(carName string, accNum string, accAlias 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