caching

package
v5.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SurrogateContextKey is the gin context key used to store surrogates generated on each response
	SurrogateContextKey = "surrogates"

	// StickyContextKey should be set to (boolean) true whenever we want an entry to be kept in cache when making room
	// for new entries
	StickyContextKey = gincache.StickyEntry

	// SplitSurrogate key (we only need one, since all splitChanges should be expired when an update is processed)
	SplitSurrogate = "sp"

	// AuthSurrogate key (having push disabled, it's safe to cache this and return it on all requests)
	AuthSurrogate = "au"
)

Variables

This section is empty.

Functions

func MakeMySegmentsEntries added in v5.4.0

func MakeMySegmentsEntries(key string) []string

MakeMySegmentsEntry create a cache entry key for mysegments

func MakeProxyCache

func MakeProxyCache() *gincache.Middleware

MakeProxyCache creates and configures a split-proxy-ready cache

func MakeSurrogateForMySegments

func MakeSurrogateForMySegments(mysegments []dtos.MySegmentDTO) []string

MakeSurrogateForMySegments creates a list surrogate keys for all the segments involved

func MakeSurrogateForSegmentChanges

func MakeSurrogateForSegmentChanges(segmentName string) string

MakeSurrogateForSegmentChanges creates a surrogate key for the segment being queried

Types

type CacheAwareSegmentSynchronizer

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

CacheAwareSegmentSynchronizer wraps a segment-sync with cache-friendly logic

func NewCacheAwareSegmentSync

func NewCacheAwareSegmentSync(
	splitStorage storage.SplitStorage,
	segmentStorage storage.SegmentStorage,
	segmentFetcher service.SegmentFetcher,
	logger logging.LoggerInterface,
	runtimeTelemetry storage.TelemetryRuntimeProducer,
	cacheFlusher gincache.CacheFlusher,
	appMonitor application.MonitorProducerInterface,
) *CacheAwareSegmentSynchronizer

NewCacheAwareSegmentSync constructs a new cache-aware segment sync

func (*CacheAwareSegmentSynchronizer) IsSegmentCached

func (c *CacheAwareSegmentSynchronizer) IsSegmentCached(segmentName string) bool

IsSegmentCached forwards the call to the wrapped sync

func (*CacheAwareSegmentSynchronizer) SegmentNames

func (c *CacheAwareSegmentSynchronizer) SegmentNames() []interface{}

SegmentNames forwards the call to the wrapped sync

func (*CacheAwareSegmentSynchronizer) SynchronizeSegment

func (c *CacheAwareSegmentSynchronizer) SynchronizeSegment(name string, till *int64) (*segment.UpdateResult, error)

SynchronizeSegment synchronizes a segment and if it was updated, flushes all entries associated with it from the http cache

func (*CacheAwareSegmentSynchronizer) SynchronizeSegments

func (c *CacheAwareSegmentSynchronizer) SynchronizeSegments() (map[string]segment.UpdateResult, error)

SynchronizeSegments syncs all the segments cached and purges cache appropriately if needed

type CacheAwareSplitSynchronizer

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

CacheAwareSplitSynchronizer wraps a SplitSynchronizer and flushes cache when an update happens

func NewCacheAwareSplitSync

func NewCacheAwareSplitSync(
	splitStorage storage.SplitStorage,
	splitFetcher service.SplitFetcher,
	logger logging.LoggerInterface,
	runtimeTelemetry storage.TelemetryRuntimeProducer,
	cacheFlusher gincache.CacheFlusher,
	appMonitor application.MonitorProducerInterface,
	flagSetsFilter flagsets.FlagSetFilter,
) *CacheAwareSplitSynchronizer

NewCacheAwareSplitSync constructs a split-sync wrapper that evicts cache on updates

func (*CacheAwareSplitSynchronizer) LocalKill

func (c *CacheAwareSplitSynchronizer) LocalKill(splitName string, defaultTreatment string, changeNumber int64)

LocalKill kills a feature flag locally and purges splitChanges entries from the http cache

func (*CacheAwareSplitSynchronizer) SynchronizeFeatureFlags added in v5.4.0

func (c *CacheAwareSplitSynchronizer) SynchronizeFeatureFlags(ffChange *dtos.SplitChangeUpdate) (*split.UpdateResult, error)

SynchronizeFeatureFlags synchronizes feature flags and if something changes, purges the cache appropriately

func (*CacheAwareSplitSynchronizer) SynchronizeSplits

func (c *CacheAwareSplitSynchronizer) SynchronizeSplits(till *int64) (*split.UpdateResult, error)

SynchronizeSplits synchronizes feature flags and if something changes, purges the cache appropriately

Jump to

Keyboard shortcuts

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