cache

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCorrupt represents a corrupt cache error
	ErrCorrupt = errors.New("cache corrupted")
)

Functions

This section is empty.

Types

type Cacher

type Cacher interface {
	// Get retrieves a value from the cache, the bool indicates if the item was found
	Get(ctx context.Context, key string) (interface{}, bool, error)
	// Set sets a value in the cache
	Set(ctx context.Context, key string, value interface{}) error
	// Delete removes a value from the cache
	Delete(ctx context.Context, key string) error
	// Flush removes all values from the cache
	Flush(ctx context.Context) error
	fmt.Stringer
}

Cacher modifies and queries a cache

type Store added in v0.16.0

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

Store wraps an existing storage.Store and provides caching

func NewStore added in v0.16.0

func NewStore(logger *logrus.Entry, cache Cacher, store storage.Store) *Store

NewStore creates a new *CacheStore

func (*Store) CreateConstraint added in v0.16.0

func (c *Store) CreateConstraint(ctx context.Context, r *flipt.CreateConstraintRequest) (*flipt.Constraint, error)

CreateConstraint delegates to the underlying store, flushing the cache in the process

func (*Store) CreateDistribution added in v0.16.0

func (c *Store) CreateDistribution(ctx context.Context, r *flipt.CreateDistributionRequest) (*flipt.Distribution, error)

CreateDistribution delegates to the underlying store, flushing the cache in the process

func (*Store) CreateFlag added in v0.16.0

func (c *Store) CreateFlag(ctx context.Context, r *flipt.CreateFlagRequest) (*flipt.Flag, error)

CreateFlag delegates to the underlying store, flushing the cache in the process

func (*Store) CreateRule added in v0.16.0

func (c *Store) CreateRule(ctx context.Context, r *flipt.CreateRuleRequest) (*flipt.Rule, error)

CreateRule delegates to the underlying store, flushing the cache in the process

func (*Store) CreateSegment added in v0.16.0

func (c *Store) CreateSegment(ctx context.Context, r *flipt.CreateSegmentRequest) (*flipt.Segment, error)

CreateSegment delegates to the underlying store, flushing the cache in the process

func (*Store) CreateVariant added in v0.16.0

func (c *Store) CreateVariant(ctx context.Context, r *flipt.CreateVariantRequest) (*flipt.Variant, error)

CreateVariant delegates to the underlying store, flushing the cache in the process

func (*Store) DeleteConstraint added in v0.16.0

func (c *Store) DeleteConstraint(ctx context.Context, r *flipt.DeleteConstraintRequest) error

DeleteConstraint delegates to the underlying store, flushing the cache in the process

func (*Store) DeleteDistribution added in v0.16.0

func (c *Store) DeleteDistribution(ctx context.Context, r *flipt.DeleteDistributionRequest) error

DeleteDistribution delegates to the underlying store, flushing the cache in the process

func (*Store) DeleteFlag added in v0.16.0

func (c *Store) DeleteFlag(ctx context.Context, r *flipt.DeleteFlagRequest) error

DeleteFlag delegates to the underlying store, flushing the cache in the process

func (*Store) DeleteRule added in v0.16.0

func (c *Store) DeleteRule(ctx context.Context, r *flipt.DeleteRuleRequest) error

DeleteRule delegates to the underlying store, flushing the cache in the process

func (*Store) DeleteSegment added in v0.16.0

func (c *Store) DeleteSegment(ctx context.Context, r *flipt.DeleteSegmentRequest) error

DeleteSegment delegates to the underlying store, flushing the cache in the process

func (*Store) DeleteVariant added in v0.16.0

func (c *Store) DeleteVariant(ctx context.Context, r *flipt.DeleteVariantRequest) error

DeleteVariant delegates to the underlying store, flushing the cache in the process

func (*Store) GetEvaluationDistributions added in v0.16.0

func (c *Store) GetEvaluationDistributions(ctx context.Context, ruleID string) ([]*storage.EvaluationDistribution, error)

GetEvaluationDistributions returns all distributions applicable to the ruleID provided from the cache if they exist; delegating to the underlying store and caching the result if no error

func (*Store) GetEvaluationRules added in v0.16.0

func (c *Store) GetEvaluationRules(ctx context.Context, flagKey string) ([]*storage.EvaluationRule, error)

GetEvaluationRules returns all rules applicable to the flagKey provided from the cache if they exist; delegating to the underlying store and caching the result if no error

func (*Store) GetFlag added in v0.16.0

func (c *Store) GetFlag(ctx context.Context, k string) (*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 (*Store) GetRule added in v0.16.0

func (c *Store) GetRule(ctx context.Context, id string) (*flipt.Rule, error)

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

func (*Store) GetSegment added in v0.16.0

func (c *Store) GetSegment(ctx context.Context, k string) (*flipt.Segment, error)

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

func (*Store) ListFlags added in v0.16.0

func (c *Store) ListFlags(ctx context.Context, opts ...storage.QueryOption) ([]*flipt.Flag, error)

ListFlags delegates to the underlying store

func (*Store) ListRules added in v0.16.0

func (c *Store) ListRules(ctx context.Context, flagKey string, opts ...storage.QueryOption) ([]*flipt.Rule, error)

ListRules delegates to the underlying store

func (*Store) ListSegments added in v0.16.0

func (c *Store) ListSegments(ctx context.Context, opts ...storage.QueryOption) ([]*flipt.Segment, error)

ListSegments delegates to the underlying store

func (*Store) OrderRules added in v0.16.0

func (c *Store) OrderRules(ctx context.Context, r *flipt.OrderRulesRequest) error

OrderRules delegates to the underlying store, flushing the cache in the process

func (*Store) String added in v0.16.0

func (c *Store) String() string

func (*Store) UpdateConstraint added in v0.16.0

func (c *Store) UpdateConstraint(ctx context.Context, r *flipt.UpdateConstraintRequest) (*flipt.Constraint, error)

UpdateConstraint delegates to the underlying store, flushing the cache in the process

func (*Store) UpdateDistribution added in v0.16.0

func (c *Store) UpdateDistribution(ctx context.Context, r *flipt.UpdateDistributionRequest) (*flipt.Distribution, error)

UpdateDistribution delegates to the underlying store, flushing the cache in the process

func (*Store) UpdateFlag added in v0.16.0

func (c *Store) UpdateFlag(ctx context.Context, r *flipt.UpdateFlagRequest) (*flipt.Flag, error)

UpdateFlag delegates to the underlying store, flushing the cache in the process

func (*Store) UpdateRule added in v0.16.0

func (c *Store) UpdateRule(ctx context.Context, r *flipt.UpdateRuleRequest) (*flipt.Rule, error)

UpdateRule delegates to the underlying store, flushing the cache in the process

func (*Store) UpdateSegment added in v0.16.0

func (c *Store) UpdateSegment(ctx context.Context, r *flipt.UpdateSegmentRequest) (*flipt.Segment, error)

UpdateSegment delegates to the underlying store, flushing the cache in the process

func (*Store) UpdateVariant added in v0.16.0

func (c *Store) UpdateVariant(ctx context.Context, r *flipt.UpdateVariantRequest) (*flipt.Variant, error)

UpdateVariant delegates to the underlying store, flushing the cache in the process

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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