Documentation ¶
Overview ¶
Package cache 本地缓存具体实现
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitLocalCache ¶
InitLocalCache Initialize the local cache, and start an independent asynchronous refresh coroutine for each projectID, and regularly pull the latest data from the remote background cache service to the local Can be initialized multiple times, concurrent and safe
Types ¶
type Application ¶
type Application struct { // Project Code ProjectID string Version string // Experiment, configuration, switch information TabConfig *protoctabcacheserver.TabConfig // Experimental barrel information ExperimentIDBucketInfoIndex map[int64]*protoctabcacheserver.BucketInfo // roaring bitmap index, bucketInfo type is bitmap, roaring bitmap object will be pre-built ExperimentIDRoaringBitmapIndex map[int64]*roaring.Bitmap // Experimental group bucket information GroupIDBucketInfoIndex map[int64]*protoctabcacheserver.BucketInfo // roaring bitmap index, bucketInfo type is bitmap, roaring bitmap object will be pre-built GroupIDRoaringBitmapIndex map[int64]*roaring.Bitmap // The layer that accounts for 100% of the overall traffic, key is layerKey, value = specific layer information FullFlowLayerIndex map[string]*protoctabcacheserver.Layer // Experiment layer index, key is layerKey, value is layer LayerIndex map[string]*protoctabcacheserver.Layer // The metadata information list of each level of the layer, from left to right, // corresponds to the layer domain structure from top to bottom LayerDomainMetadataListIndex map[string][]*protoctabcacheserver.DomainMetadata // Monitor and report component initialization parameters, key is the plugin name, // value is the initialization parameter, parse remote cache data MetricsPluginInitConfigIndex map[string]*protoctabcacheserver.MetricsInitConfig // dmp tag information, from left to right, the keys are unitIDType-dmp platform enumeration ID-dmp tag DMPTagInfo map[protoctabcacheserver.UnitIDType]map[int64]map[string]interface{} // Mapping of parameters to experimental layers VariantKeyLayerMap map[string][]string // Whether to preprocess dmp tags PreparedDMPTag bool // Whether to disable the dmp tag, then the abtest traffic will be completely diverted to the local cache, // and there will be no rpc. If disabled, the dmp tag will not be hit by default DisableDMPTag bool // contains filtered or unexported fields }
Application Locally cached entities
func NewAndSetApplication ¶
func NewAndSetApplication(ctx context.Context, projectID string) (application *Application, err error)
NewAndSetApplication builds a new application, obtains the latest data from the background cache service, and automatically updates the local cache after the data is obtained normally If the returned application is not empty, it can ensure that ExperimentData, ConfigData, and ControlData under TabConfig are not nil, Avoid multiple empty judgments in the place where it is used