caching

package
v0.0.0-...-d769a67 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	APP_BUCKET = []byte("AppBucketV2")
)
View Source
var (
	// ErrKeyNotFound is returned if value is not found
	ErrKeyNotFound = errors.New("key not found")
)

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 BoltCacheStore

type BoltCacheStore struct {
	Path string
	// contains filtered or unexported fields
}

func (*BoltCacheStore) Close

func (bcs *BoltCacheStore) Close() error

func (*BoltCacheStore) Get

func (bcs *BoltCacheStore) Get(key string, rv interface{}) error

func (*BoltCacheStore) Open

func (bcs *BoltCacheStore) Open() error

func (*BoltCacheStore) Set

func (bcs *BoltCacheStore) Set(key string, val interface{}) error

type CFClientAdapter

type CFClientAdapter struct {
	CF *cfclient.Client
}

func (*CFClientAdapter) DoGet

func (c *CFClientAdapter) DoGet(url string) (io.ReadCloser, error)

type CFSimpleClient

type CFSimpleClient interface {
	DoGet(url string) (io.ReadCloser, error)
}

type CacheLazyFill

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

func NewCacheLazyFill

func NewCacheLazyFill(client CFSimpleClient, store CacheStore, config *CacheLazyFillConfig) *CacheLazyFill

func (*CacheLazyFill) FillCache

func (c *CacheLazyFill) FillCache() error

FillCache communicates with the server to enumerate *all* applications and fills the cache

func (*CacheLazyFill) GetApp

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

type CacheLazyFillConfig

type CacheLazyFillConfig struct {
	// IgnoreMissingApps no error if an app can't be found
	IgnoreMissingApps bool

	// CacheInvalidateTTL is the approx TTL for cached data. Code will randomly pick between 0.75x and 1.2
	CacheInvalidateTTL time.Duration
	StripAppSuffixes   []string
}

type CacheStore

type CacheStore interface {
	// Open initializes the store
	Open() error

	// Close closes the store
	Close() error

	// Get looks up key, and decodes it into rv.
	// Returns ErrKeyNotFound if not found
	Get(key string, rv interface{}) error

	// Set encodes the value and stores it
	Set(key string, value interface{}) error
}

CacheStore provides a mechanism to persist data After it has been opened, Get / Set are threadsafe

type Caching

type Caching interface {
	FillCache() error
	GetApp(string) (*App, error)
}

type MemoryCacheStore

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

func (*MemoryCacheStore) Close

func (mcs *MemoryCacheStore) Close() error

func (*MemoryCacheStore) Get

func (mcs *MemoryCacheStore) Get(key string, rv interface{}) error

func (*MemoryCacheStore) Open

func (mcs *MemoryCacheStore) Open() error

func (*MemoryCacheStore) Set

func (mcs *MemoryCacheStore) Set(key string, val interface{}) 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