cache

package
v1.61.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NavigationCacheKey is used to cache the navigation bar data
	NavigationCacheKey = "navigation-cache"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type List added in v1.56.0

type List struct {
	Navigation *NavigationCache
}

List is a list of caches for the dp-frontend-dataset-controller

func GetMockCacheList

func GetMockCacheList(ctx context.Context, langs []string) (*List, error)

GetMockCacheList returns a mocked list of cache which contains the census topic cache and navigation cache

type NavigationCache struct {
	*dpcache.Cache
}

NavigationCache is a wrapper to dpcache.Cache which has additional fields and methods specifically for caching navigation data

func NewNavigationCache

func NewNavigationCache(ctx context.Context, updateInterval *time.Duration) (*NavigationCache, error)

NewNavigationCache create a navigation cache object to be used in the service which will update at every updateInterval If updateInterval is nil, this means that the cache will only be updated once at the start of the service

func (nc *NavigationCache) AddUpdateFunc(key string, updateFunc func() *models.Navigation)

AddUpdateFunc adds an update function to the cache

func (nc *NavigationCache) GetCachingKeyForNavigationLanguage(lang string) string
func (nc *NavigationCache) GetNavigationData(ctx context.Context, lang string) (*models.Navigation, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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