Version: v0.0.0-...-46d7da7 Latest Latest

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

Go to latest
Published: Jul 20, 2018 License: Apache-2.0 Imports: 11 Imported by: 0



Package checkcache provides a scalable cache to hold results of Mixer.Check operations.

Entries are added into the cache by supplying an attribute bag along with a ReferencedAttributes struct which determines the set of attributes in the bag should be used as a cache lookup key. Entries are looked up from the cache using an attribute bag.



This section is empty.


This section is empty.


This section is empty.


type Cache

type Cache struct {
	// contains filtered or unexported fields

Cache holds cached results of calls to Mixer.Check

func New

func New(capacity int32) *Cache

New creates a new instance of a check cache with the given maximum capacity. Adding more items to the cache then its capacity will cause eviction of older entries.

func (*Cache) Close

func (cc *Cache) Close() error

Close releases any resources used by the check cache.

func (*Cache) Get

func (cc *Cache) Get(attrs attribute.Bag) (Value, bool)

Get looks up an attribute bag in the cache.

func (*Cache) Set

func (cc *Cache) Set(attrs attribute.Bag, value Value)

Set enters a new value in the cache.

type Value

type Value struct {
	// StatusCode for the Check operation
	StatusCode int32

	// StatusMessage for the Check operation
	StatusMessage string

	// Expiration is the point at which this cache value becomes stale and shouldn't be used
	Expiration time.Time

	// ValidUseCount for the Check operation
	ValidUseCount int32

	// ReferencedAttributes for the Check operation
	ReferencedAttributes mixerpb.ReferencedAttributes

Value holds the data that the check cache stores.

Jump to

Keyboard shortcuts

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