caching

package
v5.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2025 License: Apache-2.0 Imports: 13 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"

	// MembershipsSurrogate key (we only need one, since all memberships should be expired when an update is processed)
	MembershipsSurrogate = "mem"

	// 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 CacheAwareLargeSegmentSynchronizer added in v5.9.0

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

CacheAwareLargeSegmentSynchronizer

func NewCacheAwareLargeSegmentSync added in v5.9.0

func NewCacheAwareLargeSegmentSync(
	splitStorage storage.SplitStorage,
	largeSegmentStorage storage.LargeSegmentsStorage,
	largeSegmentFetcher service.LargeSegmentFetcher,
	logger logging.LoggerInterface,
	runtimeTelemetry storage.TelemetryRuntimeProducer,
	cacheFlusher gincache.CacheFlusher,
	appMonitor application.MonitorProducerInterface,
) *CacheAwareLargeSegmentSynchronizer

func (*CacheAwareLargeSegmentSynchronizer) IsCached added in v5.9.0

func (*CacheAwareLargeSegmentSynchronizer) SynchronizeLargeSegment added in v5.9.0

func (c *CacheAwareLargeSegmentSynchronizer) SynchronizeLargeSegment(name string, till *int64) (*int64, error)

func (*CacheAwareLargeSegmentSynchronizer) SynchronizeLargeSegmentUpdate added in v5.9.0

func (c *CacheAwareLargeSegmentSynchronizer) SynchronizeLargeSegmentUpdate(lsRFDResponseDTO *dtos.LargeSegmentRFDResponseDTO) (*int64, error)

func (*CacheAwareLargeSegmentSynchronizer) SynchronizeLargeSegments added in v5.9.0

func (c *CacheAwareLargeSegmentSynchronizer) SynchronizeLargeSegments() (map[string]*int64, error)

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,
	ruleBasedStorage storage.RuleBasedSegmentsStorage,
	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,
	ruleBasedStorage storage.RuleBasedSegmentsStorage,
	splitFetcher service.SplitFetcher,
	logger logging.LoggerInterface,
	runtimeTelemetry storage.TelemetryRuntimeProducer,
	cacheFlusher gincache.CacheFlusher,
	appMonitor application.MonitorProducerInterface,
	flagSetsFilter flagsets.FlagSetFilter,
	specVersion string,
	ruleBuilder grammar.RuleBuilder,
) *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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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