caching

package
v0.0.0-...-232336a Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2018 License: MIT Imports: 13 Imported by: 46

Documentation

Index

Constants

View Source
const (
	APP_BUCKET = "AppBucket"
)

Variables

This section is empty.

Functions

func IsNeeded

func IsNeeded(wantedEvents string) bool

Types

type App

type App struct {
	Name       string
	Guid       string
	SpaceName  string
	SpaceGuid  string
	OrgName    string
	OrgGuid    string
	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)
	ListOrgs() ([]cfclient.Org, error)
	OrgSpaces(guid string) ([]cfclient.Space, error)
	GetAppByGuidNoInlineCall(appGuid string) (cfclient.App, error)
}

type Caching

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

func NewCachingEmpty

func NewCachingEmpty() Caching

type CachingBolt

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

func NewCachingBolt

func NewCachingBolt(client AppClient, config *CachingBoltConfig) (*CachingBolt, error)

func (*CachingBolt) Close

func (c *CachingBolt) Close() error

func (*CachingBolt) GetAllApps

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

GetAllApps returns all apps info

func (*CachingBolt) GetApp

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

GetAppInfo tries first get app info from cache. If caches doesn't have this app info (cache miss), it issues API to retrieve the app info from remote if the app is not already missing and clients don't ignore the missing app info, and then add the app info to the cache On the other hand, if the app is already missing and clients want to save remote API and ignore missing app, then a nil app info and an error will be returned.

func (*CachingBolt) Open

func (c *CachingBolt) Open() error

type CachingBoltConfig

type CachingBoltConfig struct {
	Path               string
	IgnoreMissingApps  bool
	CacheInvalidateTTL time.Duration
	RequestBySec       int
}

type CachingEmpty

type CachingEmpty struct{}

func (*CachingEmpty) Close

func (c *CachingEmpty) Close() error

func (*CachingEmpty) GetAllApps

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

func (*CachingEmpty) GetApp

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

func (*CachingEmpty) Open

func (c *CachingEmpty) Open() error

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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