cache

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[K string, V any] struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache[K string, V any](ttl time.Duration) *Cache[K, V]

func (*Cache[K, V]) ComputeIfAbsent

func (c *Cache[K, V]) ComputeIfAbsent(key K, f func() (V, error)) (*V, error)

func (*Cache[K, V]) Delete

func (c *Cache[K, V]) Delete(key K)

func (*Cache[K, V]) EvictAll

func (c *Cache[K, V]) EvictAll()

func (*Cache[K, V]) Get

func (c *Cache[K, V]) Get(key K) (V, bool)

func (*Cache[K, V]) SetWithTTL

func (c *Cache[K, V]) SetWithTTL(key K, value V, ttl time.Duration) bool

type MultiCacheGroup added in v0.5.1

type MultiCacheGroup struct {

	// key: resourceId:versionName -> versionId
	VersionNameIdCache *Cache[string, int]
	// key: versionId:os:arch
	FullUpdateStorageCache *Cache[string, *ent.Storage]

	// key: targetVersionId:currentVersionId:os:arch / cache empty
	IncrementalUpdateInfoCache *Cache[string, *model.IncrementalUpdateInfo]

	// resourceId:os:arch:channel / cache empty
	MultiVersionInfoCache *Cache[string, *model.MultiVersionInfo]

	ResourceInfoCache *Cache[string, *ent.Resource]

	FilesizeStatCache *Cache[string, int64]
}

func NewVersionCacheGroup

func NewVersionCacheGroup(rdb *redis.Client) *MultiCacheGroup

func (*MultiCacheGroup) EvictAll added in v0.5.1

func (g *MultiCacheGroup) EvictAll()

func (*MultiCacheGroup) GetCacheKey added in v0.5.1

func (g *MultiCacheGroup) GetCacheKey(elems ...string) string

Jump to

Keyboard shortcuts

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