cache

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheManager

type CacheManager interface {
	SearchStats() SearchStatsCache
	Close()
}

func NewCacheManagerImpl

func NewCacheManagerImpl(mdb *sql.DB, refreshIntervals map[string]time.Duration) CacheManager

type CacheManagerImpl

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

func (*CacheManagerImpl) Close

func (cm *CacheManagerImpl) Close()

func (*CacheManagerImpl) SearchStats

func (cm *CacheManagerImpl) SearchStats() SearchStatsCache

type ClassByTypeStats

type ClassByTypeStats map[string]Histogram

type Histogram

type Histogram map[string]int

func (Histogram) Increment

func (h Histogram) Increment(k string, v int)

func (Histogram) Merge

func (h Histogram) Merge(other Histogram)

type Provider

type Provider interface {
	Refreshable
	String() string
}

type Refreshable

type Refreshable interface {
	Refresh() error
}

type SearchStatsCache

type SearchStatsCache interface {
	Provider
	IsTagWithUnits(uid string, cts ...string) bool
	IsTagWithEnoughUnits(uid string, count int, cts ...string) bool
	IsSourceWithUnits(uid string, cts ...string) bool
	IsSourceWithEnoughUnits(uid string, count int, cts ...string) bool

	// |location| can be of: "Moscow" or "Russia|Moscow" or "Russia" or "" (empty for year constrain only)
	// |year| is 4 digit year string, e.g., "1998", "2010" or "" (empty for location constrain only)
	DoesConventionExist(location string, year string) bool
	DoesConventionSingle(location string, year string) bool
	// |holiday| is the UID of the tag that is children of 'holidays' tag
	DoesHolidayExist(holiday string, year string) bool
	DoesHolidaySingle(holiday string, year string) bool

	// Some of the sources (consts.NOT_TO_INCLUDE_IN_SOURCE_BY_POSITION) are restricted from these functions so you should not use them for general porpuses.
	GetSourceByPositionAndParent(parent string, position string, sourceTypeIds []int64) *string
	GetSourceParentAndPosition(source string, getSourceTypeIds bool) (*string, *string, []int64, error)

	GetProgramByCollectionAndPosition(collection_uid string, position string) *string
}

func NewSearchStatsCacheImpl

func NewSearchStatsCacheImpl(mdb *sql.DB) SearchStatsCache

type SearchStatsCacheImpl

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

func (*SearchStatsCacheImpl) DoesConventionExist added in v1.6.6

func (ssc *SearchStatsCacheImpl) DoesConventionExist(location string, year string) bool

func (*SearchStatsCacheImpl) DoesConventionSingle added in v1.7.5

func (ssc *SearchStatsCacheImpl) DoesConventionSingle(location string, year string) bool

func (*SearchStatsCacheImpl) DoesHolidayExist added in v1.7.5

func (ssc *SearchStatsCacheImpl) DoesHolidayExist(holiday string, year string) bool

func (*SearchStatsCacheImpl) DoesHolidaySingle added in v1.7.5

func (ssc *SearchStatsCacheImpl) DoesHolidaySingle(holiday string, year string) bool

func (*SearchStatsCacheImpl) GetProgramByCollectionAndPosition added in v1.12.0

func (ssc *SearchStatsCacheImpl) GetProgramByCollectionAndPosition(collection_uid string, position string) *string

func (*SearchStatsCacheImpl) GetSourceByPositionAndParent added in v1.10.4

func (ssc *SearchStatsCacheImpl) GetSourceByPositionAndParent(parent string, position string, sourceTypeIds []int64) *string

func (*SearchStatsCacheImpl) GetSourceParentAndPosition added in v1.10.4

func (ssc *SearchStatsCacheImpl) GetSourceParentAndPosition(source string, getSourceTypeIds bool) (*string, *string, []int64, error)

func (*SearchStatsCacheImpl) IsSourceWithEnoughUnits added in v1.5.2

func (ssc *SearchStatsCacheImpl) IsSourceWithEnoughUnits(uid string, count int, cts ...string) bool

func (*SearchStatsCacheImpl) IsSourceWithUnits

func (ssc *SearchStatsCacheImpl) IsSourceWithUnits(uid string, cts ...string) bool

func (*SearchStatsCacheImpl) IsTagWithEnoughUnits added in v1.5.2

func (ssc *SearchStatsCacheImpl) IsTagWithEnoughUnits(uid string, count int, cts ...string) bool

func (*SearchStatsCacheImpl) IsTagWithUnits

func (ssc *SearchStatsCacheImpl) IsTagWithUnits(uid string, cts ...string) bool

func (*SearchStatsCacheImpl) Refresh

func (ssc *SearchStatsCacheImpl) Refresh() error

func (*SearchStatsCacheImpl) String

func (ssc *SearchStatsCacheImpl) String() string

type StatsNode

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

type StatsTree

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

func NewStatsTree

func NewStatsTree() *StatsTree

Jump to

Keyboard shortcuts

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