cache

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APP_BUCKET = "AppBucket"
)

Variables

View Source
var (
	ErrMissingAndIgnored = errors.New("App was missing from the in-memory cache and ignored")
)

Functions

This section is empty.

Types

type App

type App struct {
	Name       string
	Guid       string
	SpaceName  string
	SpaceGuid  string
	OrgName    string
	OrgGuid    string
	CfAppEnv   map[string]interface{}
	IgnoredApp bool
}

func (App) MarshalEasyJSON

func (v App) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (App) MarshalJSON

func (v App) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*App) UnmarshalEasyJSON

func (v *App) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*App) UnmarshalJSON

func (v *App) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type AppClient

type AppClient interface {
	AppByGuid(appGuid string) (cfclient.App, error)
	ListApps() ([]cfclient.App, error)
	ListAppsByQueryWithLimits(query url.Values, totalPages int) ([]cfclient.App, error)
	GetSpaceByGuid(spaceGUID string) (cfclient.Space, error)
	GetOrgByGuid(orgGUID string) (cfclient.Org, error)
}

type Boltdb

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

func NewBoltdb

func NewBoltdb(client AppClient, config *BoltdbConfig) (*Boltdb, error)

func (*Boltdb) Close

func (c *Boltdb) Close() error

func (*Boltdb) GetAllApps

func (c *Boltdb) GetAllApps() (map[string]*App, error)

GetAllApps returns all apps info

func (*Boltdb) GetApp

func (c *Boltdb) GetApp(appGuid string) (*App, error)

GetApp tries to retrieve the app info from in-memory cache. If it finds the app then it returns. If the app is added to missing app cache then it will return ErrMissingAndIgnored. If the app is not found in in-memory cache and missing app cache, it'll make an API request to retrieve the app info from remote. If found, the app will be added to the cache and returns. If not found on remote, it'll try to retrieve from boltdb databse. If found, returns. If not found and IgnoreMissingApps congig is enabled, the app will be added to missingApps cache.

func (*Boltdb) ManuallyInvalidateCaches added in v1.3.0

func (c *Boltdb) ManuallyInvalidateCaches() error

func (*Boltdb) Open

func (c *Boltdb) Open() error

type BoltdbConfig

type BoltdbConfig struct {
	Path               string
	IgnoreMissingApps  bool
	MissingAppCacheTTL time.Duration
	AppCacheTTL        time.Duration
	OrgSpaceCacheTTL   time.Duration
	AppLimits          int

	Logger lager.Logger
}

type Cache

type Cache interface {
	Open() error
	Close() error
	GetAllApps() (map[string]*App, error)
	GetApp(string) (*App, error)
}

func NewNoCache

func NewNoCache() Cache

type NoCache

type NoCache struct{}

func (*NoCache) Close

func (c *NoCache) Close() error

func (*NoCache) GetAllApps

func (c *NoCache) GetAllApps() (map[string]*App, error)

func (*NoCache) GetApp

func (c *NoCache) GetApp(appGuid string) (*App, error)

func (*NoCache) Open

func (c *NoCache) Open() error

type Org added in v1.3.0

type Org struct {
	Name        string
	LastUpdated time.Time
}

Org is a CAPI org

type Space added in v1.3.0

type Space struct {
	Name        string
	OrgGUID     string
	LastUpdated time.Time
}

Space is a CAPI space with a reference to its org's GUID

Jump to

Keyboard shortcuts

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