cache

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCacheCorrupt = errors.New("cache corrupted")

ErrCacheCorrupt represents a corrupt cache error

Functions

This section is empty.

Types

type Cacher

type Cacher interface {
	Get(key interface{}) (interface{}, bool)
	Add(key, value interface{}) bool
	Remove(key interface{})
}

Cacher modifies and queries a cache

type FlagCache

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

FlagCache wraps a FlagStore and provides caching

func NewFlagCache

func NewFlagCache(logger logrus.FieldLogger, cacher Cacher, store storage.FlagStore) *FlagCache

NewFlagCache creates a FlagCache by wrapping a storage.FlagStore

func (*FlagCache) CreateFlag

func (f *FlagCache) CreateFlag(ctx context.Context, r *flipt.CreateFlagRequest) (*flipt.Flag, error)

CreateFlag delegates to the underlying store, caching the result if no error

func (*FlagCache) CreateVariant

func (f *FlagCache) CreateVariant(ctx context.Context, r *flipt.CreateVariantRequest) (*flipt.Variant, error)

CreateVariant invalidates the cache key and delegates to the underlying store

func (*FlagCache) DeleteFlag

func (f *FlagCache) DeleteFlag(ctx context.Context, r *flipt.DeleteFlagRequest) error

DeleteFlag invalidates the cache key and delegates to the underlying store

func (*FlagCache) DeleteVariant

func (f *FlagCache) DeleteVariant(ctx context.Context, r *flipt.DeleteVariantRequest) error

DeleteVariant invalidates the cache key and delegates to the underlying store

func (*FlagCache) GetFlag

func (f *FlagCache) GetFlag(ctx context.Context, r *flipt.GetFlagRequest) (*flipt.Flag, error)

GetFlag returns the flag from the cache if it exists; otherwise it delegates to the underlying store caching the result if no error

func (*FlagCache) ListFlags

func (f *FlagCache) ListFlags(ctx context.Context, r *flipt.ListFlagRequest) ([]*flipt.Flag, error)

ListFlags delegates to the underlying store

func (*FlagCache) UpdateFlag

func (f *FlagCache) UpdateFlag(ctx context.Context, r *flipt.UpdateFlagRequest) (*flipt.Flag, error)

UpdateFlag invalidates the cache key and delegates to the underlying store

func (*FlagCache) UpdateVariant

func (f *FlagCache) UpdateVariant(ctx context.Context, r *flipt.UpdateVariantRequest) (*flipt.Variant, error)

UpdateVariant invalidates the cache key and delegates to the underlying store

Jump to

Keyboard shortcuts

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