Documentation ¶
Index ¶
- func WithCustomOptions(customOptions CustomOptions) func(options *Options)
- func WithLocalOptions(localOptions LocalOptions) func(options *Options)
- func WithRedisOptions(redisOptions RedisOptions) func(options *Options)
- type CampaignCache
- type CampaignCacheMap
- type CustomManager
- type CustomOptions
- type LocalDBManager
- type LocalOptions
- type Manager
- type ManagerType
- type OptionBuilder
- type Options
- type RedisManager
- type RedisOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithCustomOptions ¶
func WithCustomOptions(customOptions CustomOptions) func(options *Options)
WithCustomOptions configures custom manager options
func WithLocalOptions ¶
func WithLocalOptions(localOptions LocalOptions) func(options *Options)
WithLocalOptions configures local options for manager
func WithRedisOptions ¶
func WithRedisOptions(redisOptions RedisOptions) func(options *Options)
WithRedisOptions configures redis options for manager
Types ¶
type CampaignCache ¶
type CampaignCache struct { VariationGroupID string VariationID string Activated bool FlagKeys []string }
CampaignCache expresses the campaign cache object to be saved for a visitor
type CampaignCacheMap ¶ added in v2.0.12
type CampaignCacheMap map[string]*CampaignCache
func (CampaignCacheMap) ToCommonStruct ¶ added in v2.0.12
func (ccmap CampaignCacheMap) ToCommonStruct() *common.VisitorAssignments
type CustomManager ¶
type CustomManager struct {
// contains filtered or unexported fields
}
CustomManager represents the local db manager object
func (*CustomManager) Get ¶
func (m *CustomManager) Get(visitorID string) (cache map[string]*CampaignCache, err error)
Get returns the campaigns in cache for this visitor
func (*CustomManager) Set ¶
func (m *CustomManager) Set(visitorID string, campaignCache map[string]*CampaignCache) (err error)
Set saves the campaigns in cache for this visitor
type CustomOptions ¶
type CustomOptions struct { Getter func(visitorID string) (map[string]*CampaignCache, error) Setter func(visitorID string, campaignCache map[string]*CampaignCache) error }
CustomOptions are the options necessary to make the local cache manager work
type LocalDBManager ¶
type LocalDBManager struct {
// contains filtered or unexported fields
}
LocalDBManager represents the local db manager object
func (*LocalDBManager) Dispose ¶
func (m *LocalDBManager) Dispose() error
Dispose frees IO resources
func (*LocalDBManager) Get ¶
func (m *LocalDBManager) Get(visitorID string) (map[string]*CampaignCache, error)
Get returns the campaigns in cache for this visitor
func (*LocalDBManager) Set ¶
func (m *LocalDBManager) Set(visitorID string, campaignCache map[string]*CampaignCache) error
Set saves the campaigns in cache for this visitor
type LocalOptions ¶
type LocalOptions struct {
DbPath string
}
LocalOptions are the options necessary to make the local cache manager work
type Manager ¶
type Manager interface { Set(visitorID string, campaignInfos map[string]*CampaignCache) error Get(visitorID string) (map[string]*CampaignCache, error) }
Manager is the interface that exposes cache manager functions
func InitManager ¶
func InitManager(optionsFunc ...OptionBuilder) (manager Manager, err error)
InitManager initialize the manager with a type and options
type ManagerType ¶
type ManagerType string
ManagerType represents infrastructure types of cache manager
const ( // Local is a local database based cache manager Local ManagerType = "local" // Redis is a redis based cache manager Redis ManagerType = "redis" // Custom is a custom based cache manager that requires set / get implementation Custom ManagerType = "custom" )
type OptionBuilder ¶
type OptionBuilder func(*Options)
OptionBuilder is a func type to set options to the FlagshipOption.
type Options ¶
type Options struct { RedisOptions LocalOptions CustomOptions // contains filtered or unexported fields }
Options expresses all the possible options for cache manager
type RedisManager ¶
type RedisManager struct {
// contains filtered or unexported fields
}
RedisManager represents a redis db manager object
func (*RedisManager) Get ¶
func (m *RedisManager) Get(visitorID string) (cache map[string]*CampaignCache, err error)
Get returns the campaigns in cache for this visitor
func (*RedisManager) Set ¶
func (m *RedisManager) Set(visitorID string, campaignCache map[string]*CampaignCache) (err error)
Set saves the campaigns in cache for this visitor